]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Mon: Copy openstack keyring files on all mons 1694/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 18 Jul 2017 21:11:55 +0000 (23:11 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 19 Jul 2017 16:28:18 +0000 (16:28 +0000)
Copies all created openstack keys on all mons.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-mon/tasks/openstack_config.yml

index 8117e98ffb1cd42b6e550a05b1c8c7f77f0d1901..a8e27eff404a9825a8039d280e73777ba59efe6e 100644 (file)
@@ -8,7 +8,7 @@
 # A future version could use "--caps CAPSFILE"
 # which will set all of capabilities associated with a given key, for all subsystems
 - name: create openstack key(s)
-  shell: "{{ docker_exec_cmd }} ceph-authtool -C /etc/ceph/{{ cluster }}.{{ item.name }}.keyring --name {{ item.name }} --add-key {{ item.key }} --cap mon \"{{ item.mon_cap|default('') }}\" --cap osd \"{{ item.osd_cap|default('') }}\" --cap mds \"{{ item.mds_cap|default('') }}\""
+  shell: "{{ docker_exec_cmd }} bash -c 'ceph-authtool -C /etc/ceph/{{ cluster }}.{{ item.name }}.keyring --name {{ item.name }} --add-key {{ item.key }} --cap mon \"{{ item.mon_cap|default('') }}\" --cap osd \"{{ item.osd_cap|default('') }}\" --cap mds \"{{ item.mds_cap|default('') }}\"'"
   args:
     creates: "/etc/ceph/{{ cluster }}.{{ item.name }}.keyring"
   with_items: "{{ openstack_keys }}"
     - "{{ openstack_keys }}"
     - "{{ openstack_key_exist.results }}"
   when: item.1.rc != 0
+
+- name: fetch openstack key(s)
+  fetch:
+    src: "/etc/ceph/{{ cluster }}.{{ item.name }}.keyring"
+    dest: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.{{ item.name }}.keyring"
+    flat: yes
+  with_items: "{{ openstack_keys }}"
+
+- name: copy to other mons the openstack key(s)
+  copy:
+    src: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.{{ item.1.name }}.keyring"
+    dest: "/etc/ceph/{{ cluster }}.{{ item.1.name }}.keyring"
+  with_nested:
+    - "{{ groups[mon_group_name] }}"
+    - "{{ openstack_keys }}"
+  delegate_to: "{{ item.0 }}"
+  when:
+    - cephx
+    - openstack_config
+    - item.0 != groups[mon_group_name] | last