2024-02-14 18:14:02 +08:00
|
|
|
- name: Set grafana_server_addr fact - ipv4
|
|
|
|
ansible.builtin.set_fact:
|
2021-11-24 00:28:02 +08:00
|
|
|
grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(grafana_network.split(',')) | first }}"
|
2020-01-13 23:24:52 +08:00
|
|
|
when:
|
2020-07-25 06:05:41 +08:00
|
|
|
- groups.get(monitoring_group_name, []) | length > 0
|
2020-01-13 23:24:52 +08:00
|
|
|
- ip_version == 'ipv4'
|
|
|
|
- dashboard_enabled | bool
|
2020-07-25 06:05:41 +08:00
|
|
|
- inventory_hostname in groups[monitoring_group_name]
|
2020-01-13 23:24:52 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set grafana_server_addr fact - ipv6
|
|
|
|
ansible.builtin.set_fact:
|
2022-05-13 02:49:04 +08:00
|
|
|
grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(grafana_network.split(',')) | last | ansible.utils.ipwrap }}"
|
2020-01-13 23:24:52 +08:00
|
|
|
when:
|
2020-07-25 06:05:41 +08:00
|
|
|
- groups.get(monitoring_group_name, []) | length > 0
|
2020-01-13 23:24:52 +08:00
|
|
|
- ip_version == 'ipv6'
|
|
|
|
- dashboard_enabled | bool
|
2020-07-25 06:05:41 +08:00
|
|
|
- inventory_hostname in groups[monitoring_group_name]
|
2020-01-13 23:24:52 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set grafana_server_addrs fact - ipv4
|
|
|
|
ansible.builtin.set_fact:
|
2021-11-24 00:28:02 +08:00
|
|
|
grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(grafana_network.split(',')) | first]) | unique }}"
|
2020-07-25 06:05:41 +08:00
|
|
|
with_items: "{{ groups.get(monitoring_group_name, []) }}"
|
2020-01-13 23:24:52 +08:00
|
|
|
when:
|
2020-07-25 06:05:41 +08:00
|
|
|
- groups.get(monitoring_group_name, []) | length > 0
|
2020-01-13 23:24:52 +08:00
|
|
|
- ip_version == 'ipv4'
|
|
|
|
- dashboard_enabled | bool
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set grafana_server_addrs fact - ipv6
|
|
|
|
ansible.builtin.set_fact:
|
2023-06-07 23:10:52 +08:00
|
|
|
grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(grafana_network.split(',')) | last | ansible.utils.ipwrap]) | unique }}"
|
2020-07-25 06:05:41 +08:00
|
|
|
with_items: "{{ groups.get(monitoring_group_name, []) }}"
|
2020-01-13 23:24:52 +08:00
|
|
|
when:
|
2020-07-25 06:05:41 +08:00
|
|
|
- groups.get(monitoring_group_name, []) | length > 0
|
2020-01-13 23:24:52 +08:00
|
|
|
- ip_version == 'ipv6'
|
|
|
|
- dashboard_enabled | bool
|