From 29c158ab71685c1eefc76f8dc7d56ef6e6abccbc Mon Sep 17 00:00:00 2001 From: Bartek Grzybowski Date: Thu, 16 Sep 2021 13:39:33 +0200 Subject: [ANSIBLE] Provision custom Grafana Home dashboard Change-Id: I85e096cbecf24c2b6914b60ec97a4f056d18bd1e Issue-ID: OOM-2833 Signed-off-by: Bartek Grzybowski --- ansible/roles/kube-prometheus-stack/defaults/main.yml | 5 +++++ ansible/roles/kube-prometheus-stack/tasks/main.yml | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'ansible/roles') diff --git a/ansible/roles/kube-prometheus-stack/defaults/main.yml b/ansible/roles/kube-prometheus-stack/defaults/main.yml index 53685bec..8803b802 100644 --- a/ansible/roles/kube-prometheus-stack/defaults/main.yml +++ b/ansible/roles/kube-prometheus-stack/defaults/main.yml @@ -1,12 +1,17 @@ --- kube_prometheus_stack: k8s_namespace: kube-prometheus + grafana_dashboards: + - { src: "grafana_dashboard.json", dest: "{{ nfs_mount_path }}/kube-prometheus/kube-prometheus-grafana/dashboards/custom/" } + - { src: "grafana_home.json", dest: "{{ nfs_mount_path }}/kube-prometheus/kube-prometheus-grafana/dashboards/" } helm_release_name: kube-prometheus-stack helm_timeout: "240s" helm_values_file: "{{ app_data_path }}/kube_prometheus_values.yaml" helm_values: grafana: adminPassword: grafana + env: + GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH: /var/lib/grafana/dashboards/grafana_home.json dashboardProviders: dashboardproviders.yaml: apiVersion: 1 diff --git a/ansible/roles/kube-prometheus-stack/tasks/main.yml b/ansible/roles/kube-prometheus-stack/tasks/main.yml index e190b758..08629e38 100644 --- a/ansible/roles/kube-prometheus-stack/tasks/main.yml +++ b/ansible/roles/kube-prometheus-stack/tasks/main.yml @@ -10,10 +10,11 @@ dest: "{{ kube_prometheus_stack.helm_values_file }}" content: "{{ kube_prometheus_stack.helm_values | combine(kube_prometheus_helm_values | default({}), recursive=True) | to_nice_yaml }}" -- name: Upload custom Grafana dashboard +- name: Upload Grafana dashboards copy: - src: grafana_dashboard.json - dest: "{{ nfs_mount_path }}/kube-prometheus/kube-prometheus-grafana/dashboards/custom/" + src: "{{ item.src }}" + dest: "{{ item.dest }}" + loop: "{{ kube_prometheus_stack.grafana_dashboards }}" - name: "Install Helm release {{ kube_prometheus_stack.helm_release_name }}" community.kubernetes.helm: -- cgit 1.2.3-korg