diff --git a/templates/local.d.config.j2 b/templates/local.d.config.j2 index fc6c9db..333e9e2 100644 --- a/templates/local.d.config.j2 +++ b/templates/local.d.config.j2 @@ -1,4 +1,18 @@ +{%- macro keyvalue(key, value, depth=0) -%} +{%- if value is string -%} +{{ key }}="{{ value }}"; +{%- elif value is mapping %} +{{ key }} { + {% for key, value in value.items() %} + {{ keyvalue(key, value) }} + {% endfor %} +} +{% elif value is iterable and (value is not string and value is not mapping) -%} +{{ key }}=["{{ value|join('", "') }}"]; +{%- endif -%} +{%- endmacro -%} + # {{ ansible_managed }} {% for key, value in item.value.items() %} -{{ key }}="{{ value }}"; +{{ keyvalue(key, value) }} {% endfor %}