]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
dashboard: always set `dashboard_server_addr`
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 25 Mar 2022 08:14:56 +0000 (09:14 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 25 Mar 2022 21:36:23 +0000 (22:36 +0100)
When running the playbook with `--limit`, if the play targeted doesn't match
hosts present in the mgr group the playbook can fail.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2063029
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-dashboard/tasks/configure_dashboard.yml

index 90fba19b096234c5436ea1e555dfb7f989e977a8..5e03266ef119906913654fa8836ae87923a1c091 100644 (file)
 
 - name: get current mgr backend - ipv4
   set_fact:
-    dashboard_server_addr: "{{ ansible_facts['all_ipv4_addresses'] | ips_in_ranges(dashboard_network.split(',')) | first }}"
+    dashboard_server_addr: "{{ hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(dashboard_network.split(',')) | first }}"
   when: ip_version == 'ipv4'
+  loop: "{{ groups.get(mgr_group_name) if groups.get(mgr_group_name, []) | length > 0 else groups.get(mon_group_name) }}"
+  delegate_to: "{{ item }}"
+  delegate_facts: True
 
 - name: get current mgr backend - ipv6
   set_fact:
-    dashboard_server_addr: "{{ ansible_facts['all_ipv6_addresses'] | ips_in_ranges(dashboard_network.split(',')) | last }}"
+    dashboard_server_addr: "{{ hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(dashboard_network.split(',')) | last }}"
   when: ip_version == 'ipv6'
+  loop: "{{ groups.get(mgr_group_name) if groups.get(mgr_group_name, []) | length > 0 else groups.get(mon_group_name) }}"
+  delegate_to: "{{ item }}"
+  delegate_facts: True
 
 - name: disable SSL for dashboard
   when: dashboard_protocol == "http"