ceph-facts: fix rgw_instances_all fact

The rgw_instances_all fact is supposed to be the list of all radosgw
instances from all rgw nodes.
But the fact is always using the local rgw_instances variable so this
won't work on multiple nodes.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
pull/5141/head
Dimitri Savineau 2020-03-24 17:11:44 -04:00 committed by Guillaume Abrioux
parent 83fdf24caf
commit 0487d21938
1 changed files with 11 additions and 5 deletions

View File

@ -59,12 +59,18 @@
- rgw_instances is undefined - rgw_instances is undefined
- rgw_multisite | bool - rgw_multisite | bool
- name: set_fact rgw_instances_all - name: set_fact rgw_instances_host
set_fact: set_fact:
rgw_instances_all: '{{ rgw_instances_all | default([]) | union([item.1 | combine({"host": item.0})]) }}' rgw_instances_host: '{{ rgw_instances_host | default([]) | union([item | combine({"host": inventory_hostname})]) }}'
with_nested: with_items: '{{ rgw_instances }}'
- "{{ groups.get(rgw_group_name, []) }}" when:
- "{{ rgw_instances }}" - inventory_hostname in groups.get(rgw_group_name, [])
- rgw_multisite | bool
- name: set_fact rgw_instances_all
set_fact:
rgw_instances_all: '{{ rgw_instances_all | default([]) | union(hostvars[item]["rgw_instances_host"]) }}'
with_items: "{{ groups.get(rgw_group_name, []) }}"
when: when:
- inventory_hostname in groups.get(rgw_group_name, []) - inventory_hostname in groups.get(rgw_group_name, [])
- rgw_multisite | bool - rgw_multisite | bool