--- - block: - name: set_fact container_exec_cmd_nfs - external 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 | bool else 'rados' }} -n client.{{ ceph_nfs_ceph_user }} -k /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ceph_nfs_ceph_user }}/keyring" delegate_node: "{{ inventory_hostname }}" when: groups.get(mon_group_name, []) | length == 0 - name: set_fact container_exec_cmd_nfs - internal set_fact: exec_cmd_nfs: "{{ container_binary + ' exec ceph-mon-' + hostvars[groups[mon_group_name][0]]['ansible_hostname'] if containerized_deployment | bool else '' }} rados" delegate_node: "{{ groups[mon_group_name][0] }}" when: groups.get(mon_group_name, []) | length > 0 - 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 delegate_to: "{{ delegate_node }}" 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 delegate_to: "{{ delegate_node }}" 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