]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-facts: move grafana fact to dedicated file
authorDimitri Savineau <dsavinea@redhat.com>
Mon, 13 Jan 2020 15:24:52 +0000 (10:24 -0500)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Mon, 13 Jan 2020 17:05:57 +0000 (12:05 -0500)
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 <dsavinea@redhat.com>
dashboard.yml
roles/ceph-facts/tasks/facts.yml
roles/ceph-facts/tasks/grafana.yml [new file with mode: 0644]

index 1865e478f45c31185e4c02074ed62c193ee28627..e647a8e63a3ff72f92fed48f07cc78b8eacc173c 100644 (file)
     - 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:
     - 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
 
index 6a9418578459ce487a3ba0f999a185c7ebd4de30..05166fedb19f71ddac0b6c576477c5a906061cd3 100644 (file)
   with_sequence: start=0 end={{ radosgw_num_instances|int - 1 }}
   when: inventory_hostname in groups.get(rgw_group_name, [])
 
-- 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 (file)
index 0000000..03b695e
--- /dev/null
@@ -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]