From 3e421ad6e6c18c4e80147e800e7f342ea26ea140 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Wed, 6 May 2020 09:31:34 -0400 Subject: [PATCH] ceph-nfs: fix internal ganesha deployment 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 (cherry picked from commit 8a890306ad870f0174f76c6445644d7f8db6396e) --- roles/ceph-nfs/tasks/start_nfs.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/roles/ceph-nfs/tasks/start_nfs.yml b/roles/ceph-nfs/tasks/start_nfs.yml index fb416bbad..d3e4ac1f8 100644 --- a/roles/ceph-nfs/tasks/start_nfs.yml +++ b/roles/ceph-nfs/tasks/start_nfs.yml @@ -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 -- 2.39.5