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 <dsavinea@redhat.com>
(cherry picked from commit 8a890306ad)
pull/5342/head
Dimitri Savineau 2020-05-06 09:31:34 -04:00 committed by Dimitri Savineau
parent da04dfdddf
commit 3e421ad6e6
1 changed files with 12 additions and 2 deletions

View 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