Support customizing grafana home dashboard

Replace grafana home dashboard with file in node_custom_config folder.

Change-Id: I00e3963ee287c526935e34169b63b1a40e6b4025
This commit is contained in:
guochao 2017-07-21 11:30:39 +08:00
parent 0cd868243f
commit 08753b404e
3 changed files with 22 additions and 0 deletions

View File

@ -19,3 +19,4 @@
- config_json.changed | bool - config_json.changed | bool
or grafana_conf.changed | bool or grafana_conf.changed | bool
or grafana_container.changed | bool or grafana_container.changed | bool
or grafana_home_dashboard.changed | bool

View File

@ -38,6 +38,20 @@
notify: notify:
- Restart grafana container - Restart grafana container
- name: Check if custom grafana home dashboard exists
local_action: "stat path={{ node_custom_config }}/grafana/grafana_home_dashboard.json"
register: grafana_custom_dashboard_file
run_once: True
- name: Copying over grafana home dashboard if exists
template:
src: "{{ node_custom_config }}/grafana/grafana_home_dashboard.json"
dest: "{{ node_config_directory }}/grafana/grafana_home_dashboard.json"
register: grafana_home_dashboard
when: grafana_custom_dashboard_file.stat.exists
notify:
- Restart grafana container
- name: Check grafana containers - name: Check grafana containers
kolla_docker: kolla_docker:
action: "compare_container" action: "compare_container"

View File

@ -6,6 +6,13 @@
"dest": "/etc/grafana/grafana.ini", "dest": "/etc/grafana/grafana.ini",
"owner": "grafana", "owner": "grafana",
"perm": "0600" "perm": "0600"
},
{
"source": "{{ container_config_directory }}/grafana_home_dashboard.json",
"dest": "/usr/share/grafana/public/dashboards/home.json",
"owner": "root",
"perm": "0644",
"optional": true
} }
], ],
"permissions": [ "permissions": [