From 28a75e1e98b97d0fa7f73d518788e64e8a49c013 Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Thu, 5 Dec 2024 14:51:33 +0100 Subject: [PATCH] Update grafana template --- roles/grafana/templates/grafana.ini.j2 | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/roles/grafana/templates/grafana.ini.j2 b/roles/grafana/templates/grafana.ini.j2 index bf32674d..e0b7cdeb 100644 --- a/roles/grafana/templates/grafana.ini.j2 +++ b/roles/grafana/templates/grafana.ini.j2 @@ -3,18 +3,22 @@ # http://docs.grafana.org/installation/configuration # https://github.com/grafana/grafana/blob/master/conf/sample.ini -{% for k, v in grafana_ini.items() %} -{% if v is not mapping %} -{{ k }} = {{ v }} -{% endif %} -{% endfor %} - {% for section, items in grafana_ini.items() %} {% if items is mapping %} [{{ section }}] -{% for k,v in items.items() %} +{% for sub_key, sub_value in items.items() %} +{% if sub_value is mapping %} + +[{{ section }}.{{ sub_key }}] +{% for k, v in sub_value.items() %} {{ k }} = {{ v }} {% endfor %} - +{% else %} +{{ sub_key }} = {{ sub_value }} +{% endif %} +{% endfor %} +{% else %} +{{ section }} = {{ items }} {% endif %} + {% endfor %}