2016-04-08 17:50:52 +02:00
|
|
|
# Managed by config management
|
2017-08-25 14:54:20 +02:00
|
|
|
{#- Some files (mainly the aliases one) require key and values
|
|
|
|
to be separated with a colon. For this `colon: True` should
|
|
|
|
be passed to the template #}
|
2017-08-24 12:49:05 +02:00
|
|
|
{%- if colon is not defined %}
|
|
|
|
{%- set colon = False %}
|
|
|
|
{%- endif %}
|
2016-04-08 18:27:15 +02:00
|
|
|
{%- macro format_value(key, value) %}
|
|
|
|
{#- Some settings, like virtual_alias_maps can take multiple values. Handle this case. -#}
|
|
|
|
{%- if value is iterable and value is not string -%}
|
2017-08-24 12:49:05 +02:00
|
|
|
{{ key }}{% if colon %}:{% endif %} {{ value|join(", ") }}
|
2016-04-08 18:27:15 +02:00
|
|
|
{%- else -%}
|
2017-08-24 12:49:05 +02:00
|
|
|
{{ key }}{% if colon %}:{% endif %} {{ value }}
|
2016-04-08 18:27:15 +02:00
|
|
|
{%- endif -%}
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
{%- if data is mapping %}
|
2018-03-07 21:17:57 +01:00
|
|
|
{% for key, value in data.items() %}
|
2016-04-08 18:27:15 +02:00
|
|
|
{{ format_value(key, value) }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{%- else %}
|
|
|
|
{#- Some settings need order, handle OrderedDict #}
|
|
|
|
{% for item in data %}
|
|
|
|
{{ format_value(item.keys()[0], item.values()[0]) }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{%- endif %}
|