From 43830515afbd22228ae41254fa2430c09997447f Mon Sep 17 00:00:00 2001 From: fmount Date: Tue, 10 Sep 2019 15:20:48 +0200 Subject: [PATCH] Inject ceph grafana dashboard layouts 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 (cherry picked from commit 9bb11c7b2a17db56cfcd7284d2190af36e17bba6) --- Vagrantfile | 2 +- .../tasks/configure_dashboard.yml | 7 +++++++ roles/ceph-facts/tasks/facts.yml | 20 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index f7fd826f6..82f25955c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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| diff --git a/roles/ceph-dashboard/tasks/configure_dashboard.yml b/roles/ceph-dashboard/tasks/configure_dashboard.yml index f389eb054..caad13935 100644 --- a/roles/ceph-dashboard/tasks/configure_dashboard.yml +++ b/roles/ceph-dashboard/tasks/configure_dashboard.yml @@ -192,3 +192,10 @@ 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 diff --git a/roles/ceph-facts/tasks/facts.yml b/roles/ceph-facts/tasks/facts.yml index 2e9b0021f..2bad00eb6 100644 --- a/roles/ceph-facts/tasks/facts.yml +++ b/roles/ceph-facts/tasks/facts.yml @@ -318,6 +318,7 @@ - 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: @@ -326,6 +327,25 @@ - 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: