ceph-ansible/roles/ceph-nfs/tasks/start_nfs.yml

70 lines
1.5 KiB
YAML

---
- name: create /etc/ganesha
file:
path: /etc/ganesha
state: directory
owner: root
group: root
mode: "0755"
- name: generate ganesha configuration file
action: config_template
args:
src: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') | default (playbook_dir + '/roles', true) }}/ceph-nfs/templates/ganesha.conf.j2"
dest: /etc/ganesha/ganesha.conf
owner: "root"
group: "root"
mode: "0644"
config_type: ini
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_include_exports_dir
- 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_include_exports_dir
- name: generate systemd unit file
become: true
template:
src: "{{ role_path }}/templates/ceph-nfs.service.j2"
dest: /etc/systemd/system/ceph-nfs@.service
owner: "root"
group: "root"
mode: "0644"
when:
- containerized_deployment
- name: systemd start nfs container
systemd:
name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}
state: started
enabled: yes
daemon_reload: yes
when:
- ceph_nfs_enable_service
- containerized_deployment
- name: start nfs gateway service
service:
name: nfs-ganesha
state: started
enabled: yes
when:
- ceph_nfs_enable_service
- not containerized_deployment