diff --git a/tasks/main.yml b/tasks/main.yml index 781e5d9..8c0338b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,4 +6,5 @@ dest: "/etc/rspamd/local.d/{{ item.key }}" mode: "0440" owner: _rspamd + lstrip_blocks: yes loop: "{{ rspamd.local_configs | dict2items }}" diff --git a/templates/local.d.config.j2 b/templates/local.d.config.j2 index 6919fea..54e6535 100644 --- a/templates/local.d.config.j2 +++ b/templates/local.d.config.j2 @@ -1,16 +1,16 @@ -{%- macro keyvalue(key, value, depth=0) -%} +{%- macro keyvalue(key, value, depth=0) %} {%- if value is string -%} {{ key }}="{{ value }}"; - {%- elif value is mapping %} + {%- elif value is mapping -%} {{ key }} { {% for key, value in value.items() %} - {{ keyvalue(key, value) }} - {% endfor %} + {{- keyvalue(key, value) }} + {% endfor -%} } - {% elif value is iterable and (value is not string and value is not mapping) -%} + {%- elif value is iterable and (value is not string and value is not mapping) -%} {{ key }}=["{{ value|join('", "') }}"]; {%- endif -%} -{%- endmacro -%} +{% endmacro -%} # {{ ansible_managed }} {% for key, value in item.value.items() %}