]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
nfs: fix nfs with external ceph cluster support
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 19 Mar 2020 19:44:20 +0000 (20:44 +0100)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Fri, 20 Mar 2020 01:39:56 +0000 (21:39 -0400)
This commit refact and fix the nfs deployment with external ceph cluster
support.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1814942
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit cc28d9ec2669f14fa2e75627093aa65905af969f)

group_vars/clients.yml.sample
roles/ceph-client/defaults/main.yml
roles/ceph-client/tasks/create_users_keys.yml
roles/ceph-nfs/tasks/main.yml
site-container.yml.sample
site.yml.sample

index 0f6b293128ddef829b2b592bd71598cbb09700a4..f65f15f9f3d015553809ab51f2f445f71fdc3b0a 100644 (file)
@@ -75,4 +75,3 @@ dummy:
 #  - { name: client.test, caps: { mon: "profile rbd", osd: "allow class-read object_prefix rbd_children, profile rbd pool=test" },  mode: "{{ ceph_keyring_permissions }}" }
 #  - { name: client.test2, caps: { mon: "profile rbd", osd: "allow class-read object_prefix rbd_children, profile rbd pool=test2" },  mode: "{{ ceph_keyring_permissions }}" }
 
-#ceph_nfs_ceph_user: { name: client.rgw.nfs0, key: 'SECRET==', caps: { mon: "allow rw", osd: "allow rwx" }, mode: "{{ ceph_keyring_permissions }}" }
index 318b9fc1b1160c1743d08d5f32dfe7c27bf89d9e..6cb86448c669012282f6f9f5cba623933a15e23c 100644 (file)
@@ -66,5 +66,3 @@ pools:
 keys:
   - { name: client.test, caps: { mon: "profile rbd", osd: "allow class-read object_prefix rbd_children, profile rbd pool=test" },  mode: "{{ ceph_keyring_permissions }}" }
   - { name: client.test2, caps: { mon: "profile rbd", osd: "allow class-read object_prefix rbd_children, profile rbd pool=test2" },  mode: "{{ ceph_keyring_permissions }}" }
-
-#ceph_nfs_ceph_user: { name: client.rgw.nfs0, key: 'SECRET==', caps: { mon: "allow rw", osd: "allow rwx" }, mode: "{{ ceph_keyring_permissions }}" }
\ No newline at end of file
index ccfe5578c2072dad5e31276e332118c950856641..61122724318daa2da624f25a34fe7f4f8513b40e 100644 (file)
@@ -47,7 +47,6 @@
     CEPH_CONTAINER_BINARY: "{{ container_binary }}"
   with_items:
     - "{{ keys }}"
-    - "{{ ceph_nfs_ceph_user | default([]) }}"
   delegate_to: "{{ delegated_node }}"
   when:
     - cephx | bool
index a2b18fd395b70529c748c42205f05a68ad0a80cf..94e0923f9de3954549dc878e9ac51b2ada60a959 100644 (file)
     - not containerized_deployment | bool
     - ansible_os_family == 'RedHat'
 
-- name: copy rgw keyring when deploying internal ganesha with external ceph cluster
-  copy:
-    src: "/etc/ceph/{{ cluster }}.{{ ceph_nfs_ceph_user }}.keyring"
-    dest: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring"
-    mode: '0600'
-    owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
-    group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
-    remote_src: true
+- name: nfs with external ceph cluster task related
   when:
     - groups.get(mon_group_name, []) | length == 0
     - ceph_nfs_ceph_user is defined
+  block:
+    - name: create keyring directory
+      file:
+        path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}"
+        state: directory
+        owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+        group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+        mode: "0755"
+      when:
+
+    - name: get client cephx keys
+      copy:
+        dest: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring"
+        content: "{{ item.content | b64decode }}"
+        mode: "{{ item.item.get('mode', '0600') }}"
+        owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+        group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+      with_items: "{{ hostvars[groups['_filtered_clients'][0]]['slurp_client_keys']['results'] | default([]) }}"
+      when:
+        - not item.get('skipped', False)
+        - item.item.name == 'client.' + ceph_nfs_ceph_user
 
 - name: include start_nfs.yml
   import_tasks: start_nfs.yml
index 098cce826a86d41d84f65aadf8dd21dfefad4040..ccbe14f9e534aa21b1016eed3bf1392d5b0d15a8 100644 (file)
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
-- hosts: nfss
+- hosts: clients
   become: True
   gather_facts: false
   any_errors_fatal: true
   tasks:
     # pre-tasks for following imports -
-    - name: set ceph nfs install 'In Progress'
+    - name: set ceph client install 'In Progress'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_nfs:
+          installer_phase_ceph_client:
             status: "In Progress"
             start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
         name: ceph-config
       tags: ['ceph_update_config']
     - import_role:
-        name: ceph-nfs
+        name: ceph-client
 
-    # post-tasks for following imports -
-    - name: set ceph nfs install 'Complete'
+    # post-tasks for preceding imports -
+    - name: set ceph client install 'Complete'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_nfs:
+          installer_phase_ceph_client:
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
-- hosts: rbdmirrors
+- hosts: nfss
   become: True
   gather_facts: false
   any_errors_fatal: true
   tasks:
     # pre-tasks for following imports -
-    - name: set ceph rbd mirror install 'In Progress'
+    - name: set ceph nfs install 'In Progress'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_rbdmirror:
+          installer_phase_ceph_nfs:
             status: "In Progress"
             start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
         name: ceph-config
       tags: ['ceph_update_config']
     - import_role:
-        name: ceph-rbd-mirror
+        name: ceph-nfs
 
-    # post-tasks for preceding imports -
-    - name: set ceph rbd mirror install 'Complete'
+    # post-tasks for following imports -
+    - name: set ceph nfs install 'Complete'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_rbdmirror:
+          installer_phase_ceph_nfs:
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
-- hosts: clients
+- hosts: rbdmirrors
   become: True
   gather_facts: false
   any_errors_fatal: true
   tasks:
     # pre-tasks for following imports -
-    - name: set ceph client install 'In Progress'
+    - name: set ceph rbd mirror install 'In Progress'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_client:
+          installer_phase_ceph_rbdmirror:
             status: "In Progress"
             start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
         name: ceph-config
       tags: ['ceph_update_config']
     - import_role:
-        name: ceph-client
+        name: ceph-rbd-mirror
 
     # post-tasks for preceding imports -
-    - name: set ceph client install 'Complete'
+    - name: set ceph rbd mirror install 'Complete'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_client:
+          installer_phase_ceph_rbdmirror:
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
index ea5fbfd6e6be8e06ad9b12feaee0674c7b4d4ea1..c29fc581b0cacc4e40cbace5af20da1441feadef 100644 (file)
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
-- hosts: nfss
+- hosts: clients
   gather_facts: false
   become: True
   any_errors_fatal: true
   pre_tasks:
-    - name: set ceph nfs install 'In Progress'
+    - name: set ceph client install 'In Progress'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_nfs:
+          installer_phase_ceph_client:
             status: "In Progress"
             start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
         name: ceph-config
       tags: ['ceph_update_config']
     - import_role:
-        name: ceph-nfs
+        name: ceph-client
 
   post_tasks:
-    - name: set ceph nfs install 'Complete'
+    - name: set ceph client install 'Complete'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_nfs:
+          installer_phase_ceph_client:
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
-- hosts: rbdmirrors
+- hosts: nfss
   gather_facts: false
   become: True
   any_errors_fatal: true
   pre_tasks:
-    - name: set ceph rbd mirror install 'In Progress'
+    - name: set ceph nfs install 'In Progress'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_rbdmirror:
+          installer_phase_ceph_nfs:
             status: "In Progress"
             start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
         name: ceph-config
       tags: ['ceph_update_config']
     - import_role:
-        name: ceph-rbd-mirror
+        name: ceph-nfs
 
   post_tasks:
-    - name: set ceph rbd mirror install 'Complete'
+    - name: set ceph nfs install 'Complete'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_rbdmirror:
+          installer_phase_ceph_nfs:
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
-- hosts: clients
+- hosts: rbdmirrors
   gather_facts: false
   become: True
   any_errors_fatal: true
   pre_tasks:
-    - name: set ceph client install 'In Progress'
+    - name: set ceph rbd mirror install 'In Progress'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_client:
+          installer_phase_ceph_rbdmirror:
             status: "In Progress"
             start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
         name: ceph-config
       tags: ['ceph_update_config']
     - import_role:
-        name: ceph-client
+        name: ceph-rbd-mirror
 
   post_tasks:
-    - name: set ceph client install 'Complete'
+    - name: set ceph rbd mirror install 'Complete'
       run_once: true
       set_stats:
         data:
-          installer_phase_ceph_client:
+          installer_phase_ceph_rbdmirror:
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"