diff --git a/pillar.example b/pillar.example index 7976469..cd33d3e 100644 --- a/pillar.example +++ b/pillar.example @@ -11,6 +11,9 @@ postfix: - someuser_2@example.com singlealiasexample: 'someuser_3@example.com' + relay_domains: + example.com: 'OK' + sasl_passwd: smtp.example.com: 'somepassword' diff --git a/postfix/init.sls b/postfix/init.sls index 66e0dd6..494496e 100644 --- a/postfix/init.sls +++ b/postfix/init.sls @@ -56,6 +56,11 @@ run-newaliases: {{ postmap_file('virtual') }} {% endif %} +# manage /etc/postfix/relay_domains if data found in pillar +{% if 'relay_domains' in pillar.get('postfix', '') %} +{{ postmap_file('relay_domains') }} +{% endif %} + # manage /etc/postfix/sasl_passwd if data found in pillar {% if 'sasl_passwd' in pillar.get('postfix', '') %} {{ postmap_file('sasl_passwd', 600) }} diff --git a/postfix/relay_domains b/postfix/relay_domains new file mode 100644 index 0000000..1992301 --- /dev/null +++ b/postfix/relay_domains @@ -0,0 +1,7 @@ +# Managed by config management +{% set canonical = salt['pillar.get']('postfix:relay_domains',{}) -%} +{% if canonical is iterable -%} +{% for key,value in salt['pillar.get']('postfix:relay_domains',{}).iteritems() -%} +{{ key }} {{ value }} +{% endfor %} +{% endif %}