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-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-common/templates/ganesha.conf.j2 b/roles/ceph-nfs/templates/ganesha.conf.j2 similarity index 71% rename from roles/ceph-common/templates/ganesha.conf.j2 rename to roles/ceph-nfs/templates/ganesha.conf.j2 index 0c661b3d3..dee5a3e83 100644 --- a/roles/ceph-common/templates/ganesha.conf.j2 +++ b/roles/ceph-nfs/templates/ganesha.conf.j2 @@ -12,15 +12,17 @@ EXPORT Access_Type = {{ ceph_nfs_ceph_access_type }}; - NFS_Protocols = {{ ceph_nfs_ceph_protocols }}; + Protocols = {{ ceph_nfs_ceph_protocols }}; - Transport_Protocols = TCP; + Transports = TCP; Sectype = sys,krb5,krb5i,krb5p; FSAL { Name = CEPH; } + + {{ ganesha_ceph_export_overrides | default(None) }} } {% endif %} {% if nfs_obj_gw %} @@ -34,9 +36,9 @@ EXPORT Access_Type = {{ ceph_nfs_rgw_access_type }}; - NFS_Protocols = {{ ceph_nfs_rgw_protocols }}; + Protocols = {{ ceph_nfs_rgw_protocols }}; - Transport_Protocols = TCP; + Transports = TCP; Sectype = sys,krb5,krb5i,krb5p; @@ -46,6 +48,9 @@ EXPORT Access_Key_Id ="{{ ceph_nfs_rgw_access_key }}"; Secret_Access_Key = "{{ ceph_nfs_rgw_secret_key }}"; } + + {{ ganesha_rgw_export_overrides | default(None) }} + } {% endif %} @@ -55,4 +60,8 @@ LOG { 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; + }