From 29763efdc3b5800f47de48fcb96633ade2817779 Mon Sep 17 00:00:00 2001 From: Danny Webb Date: Tue, 23 Nov 2021 16:28:02 +0000 Subject: [PATCH] make grafana network a configurable option Signed-off-by: Danny Webb (cherry picked from commit 189ff9337202ce1900a8f6f8c3e48a6e3ecb7519) --- group_vars/all.yml.sample | 1 + group_vars/rhcs.yml.sample | 1 + roles/ceph-defaults/defaults/main.yml | 1 + roles/ceph-facts/tasks/grafana.yml | 8 ++++---- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 5c7fe21ed..e7757ad1d 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -701,6 +701,7 @@ dummy: # - grafana-piechart-panel #grafana_allow_embedding: True #grafana_port: 3000 +#grafana_network: "{{ public_network }}" #grafana_conf_overrides: {} #prometheus_container_image: "docker.io/prom/prometheus:v2.7.2" #prometheus_container_cpu_period: 100000 diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index edef99f08..6cbc1fee7 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -701,6 +701,7 @@ grafana_container_image: registry.redhat.io/rhceph/rhceph-5-dashboard-rhel8:5 # - grafana-piechart-panel #grafana_allow_embedding: True #grafana_port: 3000 +#grafana_network: "{{ public_network }}" #grafana_conf_overrides: {} prometheus_container_image: registry.redhat.io/openshift4/ose-prometheus:v4.6 #prometheus_container_cpu_period: 100000 diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index d65cdd533..a7054dffb 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -693,6 +693,7 @@ grafana_plugins: - grafana-piechart-panel grafana_allow_embedding: True grafana_port: 3000 +grafana_network: "{{ public_network }}" grafana_conf_overrides: {} prometheus_container_image: "docker.io/prom/prometheus:v2.7.2" prometheus_container_cpu_period: 100000 diff --git a/roles/ceph-facts/tasks/grafana.yml b/roles/ceph-facts/tasks/grafana.yml index 28a7875f7..6228cd678 100644 --- a/roles/ceph-facts/tasks/grafana.yml +++ b/roles/ceph-facts/tasks/grafana.yml @@ -1,6 +1,6 @@ - name: set grafana_server_addr fact - ipv4 set_fact: - grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first }}" + grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(grafana_network.split(',')) | first }}" when: - groups.get(monitoring_group_name, []) | length > 0 - ip_version == 'ipv4' @@ -9,7 +9,7 @@ - name: set grafana_server_addr fact - ipv6 set_fact: - grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ipwrap }}" + grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(grafana_network.split(',')) | last | ipwrap }}" when: - groups.get(monitoring_group_name, []) | length > 0 - ip_version == 'ipv6' @@ -18,7 +18,7 @@ - name: set grafana_server_addrs fact - ipv4 set_fact: - grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first]) | unique }}" + grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(grafana_network.split(',')) | first]) | unique }}" with_items: "{{ groups.get(monitoring_group_name, []) }}" when: - groups.get(monitoring_group_name, []) | length > 0 @@ -27,7 +27,7 @@ - name: set grafana_server_addrs fact - ipv6 set_fact: - grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ipwrap]) | unique }}" + grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(grafana_network.split(',')) | last | ipwrap]) | unique }}" with_items: "{{ groups.get(monitoring_group_name, []) }}" when: - groups.get(monitoring_group_name, []) | length > 0