From d1e4b831062988af8b43416ce9ac3cb97f7f3c80 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Fri, 25 Mar 2022 09:14:56 +0100 Subject: [PATCH] dashboard: always set `dashboard_server_addr` 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 (cherry picked from commit 72e4654aaea9638627c3e44d917d5af2a6ecdf0c) --- roles/ceph-dashboard/tasks/configure_dashboard.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/roles/ceph-dashboard/tasks/configure_dashboard.yml b/roles/ceph-dashboard/tasks/configure_dashboard.yml index 99456780ba..b1f96c3e75 100644 --- a/roles/ceph-dashboard/tasks/configure_dashboard.yml +++ b/roles/ceph-dashboard/tasks/configure_dashboard.yml @@ -10,13 +10,19 @@ - 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 command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} config set mgr mgr/dashboard/ssl false"