mon: refactor of mgr key fetching

There is no need to stat for created mgr keyrings since they are created
anyway when deploying a ceph cluster > jewel. In case of a jewel
deployment we won't enter that block.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/2594/head
Guillaume Abrioux 2018-05-15 12:20:08 +02:00 committed by Sébastien Han
parent 926be51b44
commit f749830897
1 changed files with 7 additions and 18 deletions

View File

@ -106,27 +106,16 @@
- not containerized_deployment_with_kv - not containerized_deployment_with_kv
with_items: "{{ groups.get(mgr_group_name, []) }}" with_items: "{{ groups.get(mgr_group_name, []) }}"
- name: stat for ceph mgr key(s) - name: fetch ceph mgr key(s)
stat: fetch:
path: "{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring" src: "{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring"
with_items: "{{ groups.get(mgr_group_name, []) }}" dest: "{{ fetch_directory }}/{{ fsid }}/{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring"
changed_when: false flat: yes
become: false with_items:
failed_when: false - "{{ groups.get(mgr_group_name, []) }}"
register: stat_mgr_keys
check_mode: no
when: when:
- "{{ groups.get(mgr_group_name, []) | length > 0 }}" - "{{ groups.get(mgr_group_name, []) | length > 0 }}"
- name: fetch ceph mgr key(s)
fetch:
src: "{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item.item]['ansible_hostname'] }}.keyring"
dest: "{{ fetch_directory }}/{{ fsid }}/{{ item.stat.path }}"
flat: yes
with_items:
- "{{ stat_mgr_keys.results }}"
when:
- item.stat.exists == true
when: when:
- not rolling_update - not rolling_update
- inventory_hostname == groups[mon_group_name]|last - inventory_hostname == groups[mon_group_name]|last