From: Ali Maredia Date: Sun, 3 Sep 2017 15:32:44 +0000 (-0400) Subject: nfs-ganesha: add config overrides section X-Git-Tag: v3.0.0rc7~3^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f3e2235b3a975a8e375e339e22505659379e648e;p=ceph-ansible.git nfs-ganesha: add config overrides section Signed-off-by: Ali Maredia --- diff --git a/group_vars/nfss.yml.sample b/group_vars/nfss.yml.sample index 6f98a0c54..aa0b113e6 100644 --- a/group_vars/nfss.yml.sample +++ b/group_vars/nfss.yml.sample @@ -60,6 +60,28 @@ dummy: #ceph_nfs_rgw_access_key: "QFAMEDSJP5DEKJO0DDXY" #ceph_nfs_rgw_secret_key: "iaSFLDVvDdQt6lkNzHyW4fPLZugBAI1g17LO0+87[MAC[M#C" +################### +# CONFIG OVERRIDE # +################### + +# Ganesha configuration file override. +# These multiline strings will be appended to the contents of the blocks in ganesha.conf and +# must be in the correct ganesha.conf format seen here: +# https://github.com/nfs-ganesha/nfs-ganesha/blob/next/src/config_samples/ganesha.conf.example +# +# Example: +#CACHEINODE { +# #Entries_HWMark = 100000; +#} +# +#ganesha_ceph_export_overrides: +#ganesha_rgw_export_overrides: +#ganesha_log_overrides: +#ganesha_conf_overrides: | +# CACHEINODE { +# #Entries_HWMark = 100000; +# } + ########## # DOCKER # ########## diff --git a/roles/ceph-common/templates/ganesha.conf.j2 b/roles/ceph-common/templates/ganesha.conf.j2 deleted file mode 100644 index 0c661b3d3..000000000 --- a/roles/ceph-common/templates/ganesha.conf.j2 +++ /dev/null @@ -1,58 +0,0 @@ -#jinja2: trim_blocks: "true", lstrip_blocks: "true" -# {{ ansible_managed }} - -{% if nfs_file_gw %} -EXPORT -{ - Export_ID={{ ceph_nfs_ceph_export_id }}; - - Path = "/"; - - Pseudo = {{ ceph_nfs_ceph_pseudo_path }}; - - Access_Type = {{ ceph_nfs_ceph_access_type }}; - - NFS_Protocols = {{ ceph_nfs_ceph_protocols }}; - - Transport_Protocols = TCP; - - Sectype = sys,krb5,krb5i,krb5p; - - FSAL { - Name = CEPH; - } -} -{% endif %} -{% if nfs_obj_gw %} -EXPORT -{ - Export_ID={{ ceph_nfs_rgw_export_id }}; - - Path = "/"; - - Pseudo = {{ ceph_nfs_rgw_pseudo_path }}; - - Access_Type = {{ ceph_nfs_rgw_access_type }}; - - NFS_Protocols = {{ ceph_nfs_rgw_protocols }}; - - Transport_Protocols = TCP; - - Sectype = sys,krb5,krb5i,krb5p; - - FSAL { - Name = RGW; - User_Id = "{{ ceph_nfs_rgw_user }}"; - Access_Key_Id ="{{ ceph_nfs_rgw_access_key }}"; - Secret_Access_Key = "{{ ceph_nfs_rgw_secret_key }}"; - } -} -{% endif %} - -LOG { - Facility { - name = FILE; - destination = "{{ ceph_nfs_log_file }}"; - enable = active; - } -} diff --git a/roles/ceph-nfs/defaults/main.yml b/roles/ceph-nfs/defaults/main.yml index 831deb52a..f731e820c 100644 --- a/roles/ceph-nfs/defaults/main.yml +++ b/roles/ceph-nfs/defaults/main.yml @@ -11,7 +11,7 @@ fetch_directory: fetch/ # at their disposal, some people might want to have it # distributed on RGW nodes. Setting 'copy_admin_key' to 'true' # will copy the admin key to the /etc/ceph/ directory -copy_admin_key: yes +copy_admin_key: false ####################### # Access type options # @@ -52,6 +52,27 @@ ceph_nfs_rgw_user: "cephnfs" #ceph_nfs_rgw_access_key: "QFAMEDSJP5DEKJO0DDXY" #ceph_nfs_rgw_secret_key: "iaSFLDVvDdQt6lkNzHyW4fPLZugBAI1g17LO0+87[MAC[M#C" +################### +# CONFIG OVERRIDE # +################### + +# Ganesha configuration file override. +# These multiline strings will be appended to the contents of the blocks in ganesha.conf and +# must be in the correct ganesha.conf format seen here: +# https://github.com/nfs-ganesha/nfs-ganesha/blob/next/src/config_samples/ganesha.conf.example +# +# Example: +#CACHEINODE { + #Entries_HWMark = 100000; +#} +# +#ganesha_ceph_export_overrides: +#ganesha_rgw_export_overrides: +#ganesha_log_overrides: +#ganesha_conf_overrides: | +# CACHEINODE { + #Entries_HWMark = 100000; +# } ########## # DOCKER # diff --git a/roles/ceph-nfs/tasks/pre_requisite.yml b/roles/ceph-nfs/tasks/pre_requisite.yml index 8b8722b48..2eb1bce47 100644 --- a/roles/ceph-nfs/tasks/pre_requisite.yml +++ b/roles/ceph-nfs/tasks/pre_requisite.yml @@ -35,12 +35,17 @@ - name: generate ganesha configuration file action: config_template args: - src: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') | default (playbook_dir + '/roles', true) }}/ceph-common/templates/ganesha.conf.j2" + 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: cat ganesha conf file to view overrides + command: cat /etc/ganesha/ganesha.conf - name: start nfs gateway service service: diff --git a/roles/ceph-nfs/templates/ganesha.conf.j2 b/roles/ceph-nfs/templates/ganesha.conf.j2 new file mode 100644 index 000000000..dee5a3e83 --- /dev/null +++ b/roles/ceph-nfs/templates/ganesha.conf.j2 @@ -0,0 +1,67 @@ +#jinja2: trim_blocks: "true", lstrip_blocks: "true" +# {{ ansible_managed }} + +{% if nfs_file_gw %} +EXPORT +{ + Export_ID={{ ceph_nfs_ceph_export_id }}; + + Path = "/"; + + Pseudo = {{ ceph_nfs_ceph_pseudo_path }}; + + Access_Type = {{ ceph_nfs_ceph_access_type }}; + + Protocols = {{ ceph_nfs_ceph_protocols }}; + + Transports = TCP; + + Sectype = sys,krb5,krb5i,krb5p; + + FSAL { + Name = CEPH; + } + + {{ ganesha_ceph_export_overrides | default(None) }} +} +{% endif %} +{% if nfs_obj_gw %} +EXPORT +{ + Export_ID={{ ceph_nfs_rgw_export_id }}; + + Path = "/"; + + Pseudo = {{ ceph_nfs_rgw_pseudo_path }}; + + Access_Type = {{ ceph_nfs_rgw_access_type }}; + + Protocols = {{ ceph_nfs_rgw_protocols }}; + + Transports = TCP; + + Sectype = sys,krb5,krb5i,krb5p; + + FSAL { + Name = RGW; + User_Id = "{{ ceph_nfs_rgw_user }}"; + Access_Key_Id ="{{ ceph_nfs_rgw_access_key }}"; + Secret_Access_Key = "{{ ceph_nfs_rgw_secret_key }}"; + } + + {{ ganesha_rgw_export_overrides | default(None) }} + +} +{% endif %} + +LOG { + Facility { + name = FILE; + destination = "{{ ceph_nfs_log_file }}"; + enable = active; + } + + {{ ganesha_log_overrides | default(None) }} +} + +{{ ganesha_conf_overrides | default(None) }} diff --git a/tests/functional/centos/7/cluster/group_vars/nfss b/tests/functional/centos/7/cluster/group_vars/nfss index f2f86b825..2d2f83bb6 100644 --- a/tests/functional/centos/7/cluster/group_vars/nfss +++ b/tests/functional/centos/7/cluster/group_vars/nfss @@ -1,3 +1,7 @@ copy_admin_key: true nfs_file_gw: false nfs_obj_gw: true +ganesha_conf_overrides: | + CACHEINODE { + Entries_HWMark = 100000; + } diff --git a/tests/functional/tests/nfs/test_nfs_ganesha.py b/tests/functional/tests/nfs/test_nfs_ganesha.py index 58cc385d1..c9b1310a8 100644 --- a/tests/functional/tests/nfs/test_nfs_ganesha.py +++ b/tests/functional/tests/nfs/test_nfs_ganesha.py @@ -17,3 +17,7 @@ class TestNFSs(object): @pytest.mark.no_docker def test_nfs_services_are_enabled(self, node, host): assert host.service("nfs-ganesha").is_enabled + + @pytest.mark.no_docker + def test_nfs_config_override(self, node, host): + assert host.file("/etc/ganesha/ganesha.conf").contains("Entries_HWMark") diff --git a/tests/functional/ubuntu/16.04/cluster/group_vars/nfss b/tests/functional/ubuntu/16.04/cluster/group_vars/nfss index f2f86b825..2d2f83bb6 100644 --- a/tests/functional/ubuntu/16.04/cluster/group_vars/nfss +++ b/tests/functional/ubuntu/16.04/cluster/group_vars/nfss @@ -1,3 +1,7 @@ copy_admin_key: true nfs_file_gw: false nfs_obj_gw: true +ganesha_conf_overrides: | + CACHEINODE { + Entries_HWMark = 100000; + }