Custom configuration for grafana

Add custom configuration for grafana

Change-Id: I03e3ab57ce538c0f86d1442c7bd30d3ce9012637
This commit is contained in:
Kevin TIBI 2018-02-27 14:30:11 +01:00 committed by Kevin Tibi
parent 378b8dd932
commit 965669b461
3 changed files with 33 additions and 0 deletions

View File

@ -9,6 +9,12 @@
- item.value.enabled | bool
with_dict: "{{ grafana_services }}"
- name: Check if extra configuration file exists
local_action: find path="{{ node_custom_config }}/grafana/"
changed_when: False
run_once: True
register: check_extra_conf_grafana
- name: Copying over config.json files
template:
src: "{{ item.key }}.json.j2"
@ -38,6 +44,21 @@
notify:
- Restart grafana container
- name: Copying over extra configuration file
become: true
vars:
service_name: "{{ item.0 }}"
template:
src: "{{ item.path }}"
dest: "{{ node_config_directory }}/grafana/{{ item.path | basename }}"
mode: "0660"
when:
- item is defined
with_items:
- "{{ check_extra_conf_grafana.files }}"
notify:
- 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

View File

@ -7,6 +7,14 @@
"owner": "grafana",
"perm": "0600"
},
{% if check_extra_conf_grafana is defined %}{% if check_extra_conf_grafana.matched > 0 %}{% for plugin in check_extra_conf_grafana.files %}
{
"source": "{{ container_config_directory }}/{{ plugin.path | basename }}",
"dest": "/etc/grafana/{{ plugin.path | basename }}",
"owner": "grafana",
"perm": "0600",
},
{% endfor %}{% endif %}{% endif %}
{
"source": "{{ container_config_directory }}/grafana_home_dashboard.json",
"dest": "/usr/share/grafana/public/dashboards/home.json",

View File

@ -0,0 +1,4 @@
---
features:
- |
Add support of custom configuration files for grafana.