From dc797971cec798a47ab0a7b9ad3cde209c369865 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Mon, 13 Jan 2020 10:24:52 -0500 Subject: [PATCH] ceph-facts: move grafana fact to dedicated file We don't need to executed the grafana fact everytime but only during the dashboard deployment. Especially for ceph-grafana, ceph-prometheus and ceph-dashboard roles. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1790303 Signed-off-by: Dimitri Savineau (cherry picked from commit f940e695ab839aafac3be73163d8c84a2d1a8ebf) --- dashboard.yml | 8 +++++++ roles/ceph-facts/tasks/facts.yml | 36 ------------------------------ roles/ceph-facts/tasks/grafana.yml | 35 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 36 deletions(-) create mode 100644 roles/ceph-facts/tasks/grafana.yml diff --git a/dashboard.yml b/dashboard.yml index 1865e478f..e647a8e63 100644 --- a/dashboard.yml +++ b/dashboard.yml @@ -57,6 +57,10 @@ - import_role: name: ceph-facts tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tasks_from: grafana + tags: ['ceph_update_config'] - import_role: name: ceph-prometheus - import_role: @@ -92,6 +96,10 @@ - import_role: name: ceph-facts tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tasks_from: grafana + tags: ['ceph_update_config'] - import_role: name: ceph-dashboard diff --git a/roles/ceph-facts/tasks/facts.yml b/roles/ceph-facts/tasks/facts.yml index 4f37808e5..a8310fb91 100644 --- a/roles/ceph-facts/tasks/facts.yml +++ b/roles/ceph-facts/tasks/facts.yml @@ -361,42 +361,6 @@ chrony_daemon_name: chrony when: ansible_os_family == "Debian" -- name: set grafana_server_addr fact - ipv4 - set_fact: - grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first }}" - when: - - groups.get(grafana_server_group_name, []) | length > 0 - - ip_version == 'ipv4' - - dashboard_enabled | bool - - inventory_hostname in groups[grafana_server_group_name] - -- name: set grafana_server_addr fact - ipv6 - set_fact: - grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ipwrap }}" - when: - - groups.get(grafana_server_group_name, []) | length > 0 - - ip_version == 'ipv6' - - dashboard_enabled | bool - - inventory_hostname in groups[grafana_server_group_name] - -- name: set grafana_server_addr fact - ipv4 - (external instance) - set_fact: - grafana_server_addr: "{{ hostvars[groups.get(grafana_server_group_name, []) | first]['ansible_all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first }}" - when: - - groups.get(grafana_server_group_name, []) | length > 0 - - ip_version == 'ipv4' - - dashboard_enabled | bool - - inventory_hostname not in groups[grafana_server_group_name] - -- name: set grafana_server_addr fact - ipv6 - (external instance) - set_fact: - grafana_server_addr: "{{ hostvars[groups.get(grafana_server_group_name, []) | first]['ansible_all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ipwrap }}" - when: - - groups.get(grafana_server_group_name, []) | length > 0 - - ip_version == 'ipv6' - - dashboard_enabled | bool - - inventory_hostname not in groups[grafana_server_group_name] - - name: set_fact use_new_ceph_iscsi package or old ceph-iscsi-config/cli set_fact: use_new_ceph_iscsi: "{{ (gateway_ip_list == '0.0.0.0' and gateway_iqn | length == 0 and client_connections | length == 0 and rbd_devices | length == 0) | bool | ternary(true, false) }}" diff --git a/roles/ceph-facts/tasks/grafana.yml b/roles/ceph-facts/tasks/grafana.yml new file mode 100644 index 000000000..03b695ee3 --- /dev/null +++ b/roles/ceph-facts/tasks/grafana.yml @@ -0,0 +1,35 @@ +- name: set grafana_server_addr fact - ipv4 + set_fact: + grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first }}" + when: + - groups.get(grafana_server_group_name, []) | length > 0 + - ip_version == 'ipv4' + - dashboard_enabled | bool + - inventory_hostname in groups[grafana_server_group_name] + +- name: set grafana_server_addr fact - ipv6 + set_fact: + grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ipwrap }}" + when: + - groups.get(grafana_server_group_name, []) | length > 0 + - ip_version == 'ipv6' + - dashboard_enabled | bool + - inventory_hostname in groups[grafana_server_group_name] + +- name: set grafana_server_addr fact - ipv4 - (external instance) + set_fact: + grafana_server_addr: "{{ hostvars[groups.get(grafana_server_group_name, []) | first]['ansible_all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first }}" + when: + - groups.get(grafana_server_group_name, []) | length > 0 + - ip_version == 'ipv4' + - dashboard_enabled | bool + - inventory_hostname not in groups[grafana_server_group_name] + +- name: set grafana_server_addr fact - ipv6 - (external instance) + set_fact: + grafana_server_addr: "{{ hostvars[groups.get(grafana_server_group_name, []) | first]['ansible_all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ipwrap }}" + when: + - groups.get(grafana_server_group_name, []) | length > 0 + - ip_version == 'ipv6' + - dashboard_enabled | bool + - inventory_hostname not in groups[grafana_server_group_name]