]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
nfs-ganesha: add config overrides section
authorAli Maredia <amaredia@redhat.com>
Sun, 3 Sep 2017 15:32:44 +0000 (11:32 -0400)
committerAli Maredia <amaredia@redhat.com>
Fri, 8 Sep 2017 15:37:58 +0000 (11:37 -0400)
Signed-off-by: Ali Maredia <amaredia@redhat.com>
group_vars/nfss.yml.sample
roles/ceph-common/templates/ganesha.conf.j2 [deleted file]
roles/ceph-nfs/defaults/main.yml
roles/ceph-nfs/tasks/pre_requisite.yml
roles/ceph-nfs/templates/ganesha.conf.j2 [new file with mode: 0644]
tests/functional/centos/7/cluster/group_vars/nfss
tests/functional/tests/nfs/test_nfs_ganesha.py
tests/functional/ubuntu/16.04/cluster/group_vars/nfss

index 6f98a0c54f816b4ae58a50e12dd98a8d54e9078f..aa0b113e65bf9296ab7e715ad2aa68d84cb2dc68 100644 (file)
@@ -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 (file)
index 0c661b3..0000000
+++ /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;
-        }
-}
index 831deb52a4dc0e800b73ddb41ce0a1642020e7f0..f731e820c7e512e5aa538bc855a63a622b36498d 100644 (file)
@@ -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 #
index 8b8722b48f1fecf62c199f897fecd2d11e82d75c..2eb1bce47522f2c40cc0029e2e502e4395b16434 100644 (file)
 - 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 (file)
index 0000000..dee5a3e
--- /dev/null
@@ -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) }}
index f2f86b825bfc47eafd53928dbf100b2f111da03a..2d2f83bb67e38c8cc9879901e2d454533b457d4d 100644 (file)
@@ -1,3 +1,7 @@
 copy_admin_key: true
 nfs_file_gw: false
 nfs_obj_gw: true
+ganesha_conf_overrides: |
+    CACHEINODE {
+            Entries_HWMark = 100000;
+    }
index 58cc385d15befe8983ed0dc43fb6bbea2bba7c3a..c9b1310a899da4ad5b13b263a9bc80d24fa4a53a 100644 (file)
@@ -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")
index f2f86b825bfc47eafd53928dbf100b2f111da03a..2d2f83bb67e38c8cc9879901e2d454533b457d4d 100644 (file)
@@ -1,3 +1,7 @@
 copy_admin_key: true
 nfs_file_gw: false
 nfs_obj_gw: true
+ganesha_conf_overrides: |
+    CACHEINODE {
+            Entries_HWMark = 100000;
+    }