]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
cephadm-adopt: copy client.admin keyring
authorDimitri Savineau <dsavinea@redhat.com>
Thu, 9 Jul 2020 15:19:41 +0000 (11:19 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Fri, 10 Jul 2020 15:08:30 +0000 (11:08 -0400)
The ceph config assimilate-conf command requires the client.admin
keyring which isn't present on all nodes most of the time.

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

infrastructure-playbooks/cephadm-adopt.yml

index db41289270e98708a6fe8a97981e100da8dd35e5..983e5a94ce24995fa88251463cea47c3f18d4648 100644 (file)
       set_fact:
         ceph_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph:/var/lib/ceph:z -v /var/run/ceph:/var/run/ceph:z --entrypoint=ceph ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'ceph' }}"
 
+    - name: get the client.admin keyring
+      command: "{{ ceph_cmd }} --cluster {{ cluster }} auth get client.admin"
+      changed_when: false
+      run_once: true
+      delegate_to: '{{ groups[mon_group_name][0] }}'
+      register: client_admin_keyring
+
+    - name: copy the client.admin keyring
+      copy:
+        dest: "/etc/ceph/{{ cluster }}.client.admin.keyring"
+        content: "{{ client_admin_keyring.stdout + '\n' }}"
+        owner: "{{ ceph_uid | int if containerized_deployment | bool else 'ceph' }}"
+        group: "{{ ceph_uid | int if containerized_deployment | bool else 'ceph' }}"
+        mode: "{{ ceph_keyring_permissions }}"
+      run_once: true
+      delegate_to: "{{ item }}"
+      with_items:
+        - "{{ groups.get(osd_group_name, []) }}"
+        - "{{ groups.get(mds_group_name, []) }}"
+        - "{{ groups.get(rgw_group_name, []) }}"
+        - "{{ groups.get(mgr_group_name, []) }}"
+        - "{{ groups.get(rbdmirror_group_name, []) }}"
+
     - name: assimilate ceph configuration
       command: "{{ ceph_cmd }} --cluster {{ cluster }} config assimilate-conf -i /etc/ceph/{{ cluster }}.conf"
       changed_when: false