diff --git a/postfix/files/main.cf b/postfix/files/main.cf index 2f7bf48..ae61bed 100644 --- a/postfix/files/main.cf +++ b/postfix/files/main.cf @@ -5,7 +5,14 @@ {% macro set_parameter(parameter, default=None) -%} {% set value = config.get(parameter, default) -%} {% if value is not none -%} + {%- if value is number or value is string %} {{ parameter }} = {{ value }} + {%- elif value is iterable %} +{{ parameter }} = + {%- for v in value %} + {{ v }}, + {%- endfor %} + {%- endif %} {%- do processed_parameters.append(parameter) -%} {% endif -%} {% endmacro -%} @@ -43,15 +50,14 @@ {{ set_parameter('myhostname', grains['fqdn']) }} {{ set_parameter('alias_maps', 'hash:' ~ postfix.aliases) }} {{ set_parameter('alias_database', 'hash:' ~ postfix.aliases) }} -{{ set_parameter('mydestination', grains['fqdn'] + ', localhost, localhost.localdomain, ' + grains['domain'] ) }} +{{ set_parameter('mydestination', [grains['fqdn'], 'localhost', 'localhost.localdomain', grains['domain']]) }} {{ set_parameter('relayhost', '') }} -{{ set_parameter('mynetworks', '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128') }} +{{ set_parameter('mynetworks', ['127.0.0.0/8', '[::ffff:127.0.0.0]/104', '[::1]/128']) }} {{ set_parameter('mailbox_size_limit', '0') }} {{ set_parameter('recipient_delimiter', '+') }} {{ set_parameter('inet_interfaces', 'all') }} {{ set_parameter('message_size_limit', '41943040') }} -{{ set_parameter('smtpd_relay_restrictions', 'permit_mynetworks permit_sasl_authenticated defer_unauth_destination') }} - +{{ set_parameter('smtpd_relay_restrictions', ['permit_mynetworks', 'permit_sasl_authenticated', 'defer_unauth_destination']) }} {% if 'virtual' in pillar.get('postfix','') %} virtual_alias_maps = hash:/etc/postfix/virtual