diff --git a/ansible/roles/grafana/tasks/config.yml b/ansible/roles/grafana/tasks/config.yml index 13b0e51878..886a612400 100644 --- a/ansible/roles/grafana/tasks/config.yml +++ b/ansible/roles/grafana/tasks/config.yml @@ -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 diff --git a/ansible/roles/grafana/templates/grafana.json.j2 b/ansible/roles/grafana/templates/grafana.json.j2 index 2b83af7471..142e5815cf 100644 --- a/ansible/roles/grafana/templates/grafana.json.j2 +++ b/ansible/roles/grafana/templates/grafana.json.j2 @@ -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", diff --git a/releasenotes/notes/ldap-grafana-configuration-0112d84771addbe7.yaml b/releasenotes/notes/ldap-grafana-configuration-0112d84771addbe7.yaml new file mode 100644 index 0000000000..03c67933d9 --- /dev/null +++ b/releasenotes/notes/ldap-grafana-configuration-0112d84771addbe7.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Add support of custom configuration files for grafana.