Merge "Custom configuration for grafana"

This commit is contained in:
Zuul 2018-04-16 08:06:37 +00:00 committed by Gerrit Code Review
commit 910180a5e2
3 changed files with 33 additions and 0 deletions

View File

@ -12,6 +12,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"
@ -45,6 +51,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.