mirror of https://github.com/ceph/ceph-ansible.git
facts: fix bug in grafana_server_addr fact setting
If no grafana-server group is defined while an mgr group is, that task
will fail because `hostvars[groups[grafana_server_group_name][0]` can't
return anything since `groups['grafana-server']` will be a non existing
key.
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 366b309c12
)
pull/4167/head
parent
adf5fdca8b
commit
b9c49227bb
|
@ -305,5 +305,7 @@
|
|||
|
||||
- name: set grafana_server_addr fact
|
||||
set_fact:
|
||||
grafana_server_addr: "{{ (hostvars[groups[grafana_server_group_name][0] | default(groups[mgr_group_name][0])])['ansible_all_ipv4_addresses'] | ipaddr(public_network) | first }}"
|
||||
when: groups.get(grafana_server_group_name, []) | length > 0 or groups.get(mgr_group_name, []) | length > 0
|
||||
grafana_server_addr: "{{ (hostvars[groups[grafana_server_group_name][0] if groups.get(grafana_server_group_name, []) | length > 0 else groups[mgr_group_name][0]])['ansible_all_ipv4_addresses'] | ipaddr(public_network) | first }}"
|
||||
when:
|
||||
- (groups.get(grafana_server_group_name, []) | length > 0 or groups.get(mgr_group_name, []) | length > 0)
|
||||
- dashboard_enabled | bool
|
||||
|
|
Loading…
Reference in New Issue