]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-nfs: fix internal ganesha deployment
authorDimitri Savineau <dsavinea@redhat.com>
Wed, 6 May 2020 13:31:34 +0000 (09:31 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Wed, 6 May 2020 17:30:21 +0000 (13:30 -0400)
Since ea2b654d9 we're not running the rados command from the monitor
nodes but from the ganesha node. Unfortunately we don't have the
required keyring on that node to run the rados command as we don't
import the right keyring.
This commit restores the workflow for internal ganesha deployment like
before ea2b654d9 but keeps the rados commands from the ganesha node for
external deployment until we have a better design.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 8a890306ad870f0174f76c6445644d7f8db6396e)

roles/ceph-nfs/tasks/start_nfs.yml

index fb416bbad778d079acd520317f56b3f75a222d28..d3e4ac1f8fdd1e79435649b14cb1c0990e1fc4c7 100644 (file)
@@ -1,8 +1,16 @@
 ---
 - block:
-  - name: set_fact container_exec_cmd_nfs
+  - name: set_fact container_exec_cmd_nfs - external
     set_fact:
-      exec_cmd_nfs: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /var/log/ceph/:/var/log/ceph/:z --entrypoint=rados ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else 'rados' }} -n client.{{ ceph_nfs_ceph_user if groups.get(mon_group_name, []) | length == 0 else 'rgw.' + ansible_hostname }} -k /var/lib/ceph/radosgw/{{ cluster + '-rgw.' +  ceph_nfs_ceph_user if groups.get(mon_group_name, []) | length == 0 else ansible_hostname }}/keyring"
+      exec_cmd_nfs: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /var/log/ceph/:/var/log/ceph/:z --entrypoint=rados ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'rados' }} -n client.{{ ceph_nfs_ceph_user }} -k /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ceph_nfs_ceph_user }}/keyring"
+      delegate_node: "{{ inventory_hostname }}"
+    when: groups.get(mon_group_name, []) | length == 0
+
+  - name: set_fact container_exec_cmd_nfs - internal
+    set_fact:
+      exec_cmd_nfs: "{{ container_binary + ' exec ceph-mon-' + hostvars[groups[mon_group_name][0]]['ansible_hostname'] if containerized_deployment | bool else '' }} rados"
+      delegate_node: "{{ groups[mon_group_name][0] }}"
+    when: groups.get(mon_group_name, []) | length > 0
 
   - name: check if rados index object exists
     shell: "{{ exec_cmd_nfs | default('') }} -p {{ cephfs_data_pool.name }} --cluster {{ cluster }} ls|grep {{ ceph_nfs_rados_export_index }}"
@@ -11,6 +19,7 @@
     register: rados_index_exists
     check_mode: no
     when: ceph_nfs_rados_backend | bool
+    delegate_to: "{{ delegate_node }}"
     run_once: true
 
   - name: create an empty rados index object
@@ -18,6 +27,7 @@
     when:
       - ceph_nfs_rados_backend | bool
       - rados_index_exists.rc != 0
+    delegate_to: "{{ delegate_node }}"
     run_once: true
 
 - name: create /etc/ganesha