From: Guillaume Abrioux Date: Thu, 16 Jun 2022 14:53:14 +0000 (+0200) Subject: facts: fix deployments with different net interface names X-Git-Tag: v6.0.28~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ab9e8aeb12bb6a8725f10196cdc666d32a36da0d;p=ceph-ansible.git facts: fix deployments with different net interface names Deployments when radosgws don't have the same names for network interface. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2095605 Signed-off-by: Guillaume Abrioux (cherry picked from commit f6b49f78a9f14c37b2ca81fa6172beba8f43adc4) --- diff --git a/roles/ceph-facts/tasks/set_radosgw_address.yml b/roles/ceph-facts/tasks/set_radosgw_address.yml index a2dc10584..aa85aaf28 100644 --- a/roles/ceph-facts/tasks/set_radosgw_address.yml +++ b/roles/ceph-facts/tasks/set_radosgw_address.yml @@ -39,21 +39,24 @@ block: - name: set_fact _interface set_fact: - _interface: "{{ (radosgw_interface | replace('-', '_')) }}" + _interface: "{{ (hostvars[item]['radosgw_interface'] | replace('-', '_')) }}" loop: "{{ groups.get(rgw_group_name, []) }}" delegate_to: "{{ item }}" + delegate_facts: true + run_once: true - name: set_fact _radosgw_address to radosgw_interface - ipv4 set_fact: - _radosgw_address: "{{ hostvars[item]['ansible_facts'][_interface][ip_version]['address'] }}" + _radosgw_address: "{{ hostvars[item]['ansible_facts'][hostvars[item]['_interface']][ip_version]['address'] }}" loop: "{{ groups.get(rgw_group_name, []) }}" delegate_to: "{{ item }}" delegate_facts: true when: ip_version == 'ipv4' + - name: set_fact _radosgw_address to radosgw_interface - ipv6 set_fact: - _radosgw_address: "{{ hostvars[item]['ansible_facts'][_interface][ip_version][0]['address'] | ansible.utils.ipwrap }}" + _radosgw_address: "{{ hostvars[item]['ansible_facts'][hostvars[item]['_interface']][ip_version][0]['address'] | ansible.utils.ipwrap }}" loop: "{{ groups.get(rgw_group_name, []) }}" delegate_to: "{{ item }}" delegate_facts: true