]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Inject ceph grafana dashboard layouts
authorfmount <fpantano@redhat.com>
Tue, 10 Sep 2019 13:20:48 +0000 (15:20 +0200)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Thu, 26 Sep 2019 17:44:03 +0000 (13:44 -0400)
This change just adds the task to inject from the
ceph dashboard mgr module the required layouts
to show all the cluster metrics on the grafana
instance.
Since we're now able to push grafana layouts through
the ceph mgr module command, the dashboards configuration
template is no longer needed on containerized environments.
This commit also fixes the Vagrantfile IP static assigment
in the grafana section because it generates an issue (it's
the same of the mgr instance).
Finally, considering some deployments that use an external
grafana server instance, we reworked the 'grafana_server_addr'
assignment to address these requirements.

Signed-off-by: fmount <fpantano@redhat.com>
(cherry picked from commit 9bb11c7b2a17db56cfcd7284d2190af36e17bba6)

Vagrantfile
roles/ceph-dashboard/tasks/configure_dashboard.yml
roles/ceph-facts/tasks/facts.yml

index f7fd826f6fbda1af5506dc1e444ba92144465437..82f25955c11b231820a5129b565ceb9bb4996183 100644 (file)
@@ -184,7 +184,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
       grf.vm.hostname = "#{LABEL_PREFIX}grafana#{i}"
       if ASSIGN_STATIC_IP
         grf.vm.network :private_network,
-          ip: "#{PUBLIC_SUBNET}.3#{i}"
+          ip: "#{PUBLIC_SUBNET}.2#{i}"
       end
       # Virtualbox
       grf.vm.provider :virtualbox do |vb|
index f389eb0549f6ba6953e25e7b5a9cc50f7e71371f..caad139359043817f39c6becc0aedbd6c644c861 100644 (file)
   changed_when: false
   delegate_to: "{{ groups[mon_group_name][0] }}"
   run_once: true
+
+- name: inject grafana dashboard layouts
+  command: "{{ container_exec_cmd }} ceph dashboard grafana dashboards update"
+  delegate_to: "{{ groups[mon_group_name][0] }}"
+  run_once: true
+  changed_when: false
+  when: containerized_deployment | bool
index 2e9b0021f63866ecda5c4901e1478330e1cbfc87..2bad00eb62723908f98c874e5d227a5a551079a5 100644 (file)
     - 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:
     - 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'] | ipaddr(public_network) | 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'] | ipaddr(public_network) | 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: