diff --git a/postfix/aliases b/postfix/aliases deleted file mode 100644 index 04fa424..0000000 --- a/postfix/aliases +++ /dev/null @@ -1,3 +0,0 @@ -# Managed by config management -# See man 5 aliases for format -{{pillar['postfix']['aliases']['content']}} diff --git a/postfix/files/mapping.j2 b/postfix/files/mapping.j2 index 976a205..a177bf4 100644 --- a/postfix/files/mapping.j2 +++ b/postfix/files/mapping.j2 @@ -1,11 +1,14 @@ # Managed by config management +{%- if colon is not defined %} + {%- set colon = False %} +{%- endif %} {%- 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 -%} -{{ key }} {{ value|join(", ") }} +{{ key }}{% if colon %}:{% endif %} {{ value|join(", ") }} {%- else -%} -{{ key }} {{ value }} +{{ key }}{% if colon %}:{% endif %} {{ value }} {%- endif -%} {%- endmacro %} diff --git a/postfix/init.sls b/postfix/init.sls index 6642bb6..b428ef3 100644 --- a/postfix/init.sls +++ b/postfix/init.sls @@ -31,11 +31,14 @@ postfix: postfix_alias_database: file.managed: - name: {{ file_path }} - - source: salt://postfix/aliases + - source: salt://postfix/files/mapping.j2 - user: root - group: {{ postfix.root_grp }} - mode: 644 - template: jinja + - context: + data: {{ salt['pillar.get']('postfix:aliases:present') }} + colon: True - require: - pkg: postfix {%- if need_newaliases %}