try to parse lists and dicts from config

This commit is contained in:
psy 2021-01-15 12:37:08 +01:00
parent 28098d3474
commit f8375f323c
No known key found for this signature in database
GPG key ID: DFF5B17AC3A8ECF5

View file

@ -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 %}