mirror of https://github.com/ceph/ceph-ansible.git
83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
---
|
|
- block:
|
|
- name: set_fact container_exec_cmd_nfs
|
|
set_fact:
|
|
exec_cmd_nfs: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /var/log/ceph/:/var/log/ceph/:z --entrypoint=rados ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else 'rados' }} -n client.{{ ceph_nfs_ceph_user if groups.get(mon_group_name, []) | length == 0 else '.rgw.' + ansible_hostname }} -k /var/lib/ceph/radosgw/{{ cluster + '-rgw.' + ceph_nfs_ceph_user if groups.get(mon_group_name, []) | length == 0 else ansible_hostname }}"
|
|
|
|
- name: check if rados index object exists
|
|
shell: "{{ exec_cmd_nfs | default('') }} -p {{ cephfs_data_pool.name }} --cluster {{ cluster }} ls|grep {{ ceph_nfs_rados_export_index }}"
|
|
changed_when: false
|
|
failed_when: false
|
|
register: rados_index_exists
|
|
check_mode: no
|
|
when: ceph_nfs_rados_backend | bool
|
|
run_once: true
|
|
|
|
- name: create an empty rados index object
|
|
command: "{{ exec_cmd_nfs | default('') }} -p {{ cephfs_data_pool.name }} --cluster {{ cluster }} put {{ ceph_nfs_rados_export_index }} /dev/null"
|
|
when:
|
|
- ceph_nfs_rados_backend | bool
|
|
- rados_index_exists.rc != 0
|
|
run_once: true
|
|
|
|
- name: create /etc/ganesha
|
|
file:
|
|
path: /etc/ganesha
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
|
|
- name: generate ganesha configuration file
|
|
template:
|
|
src: "ganesha.conf.j2"
|
|
dest: /etc/ganesha/ganesha.conf
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0644"
|
|
notify: restart ceph nfss
|
|
|
|
- name: create exports directory
|
|
file:
|
|
path: /etc/ganesha/export.d
|
|
state: directory
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0755"
|
|
when: ceph_nfs_dynamic_exports | bool
|
|
|
|
- name: create exports dir index file
|
|
copy:
|
|
content: ""
|
|
force: no
|
|
dest: /etc/ganesha/export.d/INDEX.conf
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0644"
|
|
when: ceph_nfs_dynamic_exports | bool
|
|
|
|
- name: include_tasks systemd.yml
|
|
include_tasks: systemd.yml
|
|
when: containerized_deployment | bool
|
|
|
|
- name: systemd start nfs container
|
|
systemd:
|
|
name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}
|
|
state: started
|
|
enabled: yes
|
|
masked: no
|
|
daemon_reload: yes
|
|
when:
|
|
- containerized_deployment | bool
|
|
- ceph_nfs_enable_service | bool
|
|
|
|
- name: start nfs gateway service
|
|
systemd:
|
|
name: nfs-ganesha
|
|
state: started
|
|
enabled: yes
|
|
masked: no
|
|
when:
|
|
- not containerized_deployment | bool
|
|
- ceph_nfs_enable_service | bool
|