From b8916ecbc1161b558958d43deffff133bd37eee0 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Wed, 4 Oct 2017 13:25:53 +0200 Subject: [PATCH] Include exports dir in ceph-nfs config file Exports dir is used when dynamic exports creation is enabled. --- group_vars/nfss.yml.sample | 3 +++ roles/ceph-nfs/defaults/main.yml | 3 +++ roles/ceph-nfs/tasks/start_nfs.yml | 19 +++++++++++++++++++ roles/ceph-nfs/templates/ganesha.conf.j2 | 4 ++++ 4 files changed, 29 insertions(+) diff --git a/group_vars/nfss.yml.sample b/group_vars/nfss.yml.sample index eb0aa08a6..4fcc94e7a 100644 --- a/group_vars/nfss.yml.sample +++ b/group_vars/nfss.yml.sample @@ -40,6 +40,9 @@ dummy: #ceph_nfs_protocols: "3,4" #ceph_nfs_access_type: "RW" #ceph_nfs_log_file: "/var/log/ganesha/ganesha.log" +# whether ganesha config file should include additional +# sub-directory with exports definitions, this is useful for dynamic exports +#ceph_nfs_include_exports_dir: false #################### # FSAL Ceph Config # diff --git a/roles/ceph-nfs/defaults/main.yml b/roles/ceph-nfs/defaults/main.yml index 6025d7e31..e0317e073 100644 --- a/roles/ceph-nfs/defaults/main.yml +++ b/roles/ceph-nfs/defaults/main.yml @@ -32,6 +32,9 @@ ceph_nfs_pseudo_path: "/cephfile" ceph_nfs_protocols: "3,4" ceph_nfs_access_type: "RW" ceph_nfs_log_file: "/var/log/ganesha/ganesha.log" +# whether ganesha config file should include additional +# sub-directory with exports definitions, this is useful for dynamic exports +ceph_nfs_include_exports_dir: false #################### # FSAL Ceph Config # diff --git a/roles/ceph-nfs/tasks/start_nfs.yml b/roles/ceph-nfs/tasks/start_nfs.yml index da5e4c3d7..567ebaa1c 100644 --- a/roles/ceph-nfs/tasks/start_nfs.yml +++ b/roles/ceph-nfs/tasks/start_nfs.yml @@ -19,6 +19,25 @@ 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: diff --git a/roles/ceph-nfs/templates/ganesha.conf.j2 b/roles/ceph-nfs/templates/ganesha.conf.j2 index 135e995fa..1e362091e 100644 --- a/roles/ceph-nfs/templates/ganesha.conf.j2 +++ b/roles/ceph-nfs/templates/ganesha.conf.j2 @@ -1,6 +1,10 @@ #jinja2: trim_blocks: "true", lstrip_blocks: "true" # {{ ansible_managed }} +{% if ceph_nfs_include_exports_dir %} +%include /etc/ganesha/export.d/INDEX.conf +{% endif %} + {% if nfs_file_gw %} EXPORT {