Add support for parameters as lists

As found in postfix documentation.
This commit is contained in:
Gilles Dartiguelongue 2015-08-22 12:39:32 +02:00
parent 723456f758
commit 9219b5e608

View File

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