manage relay_domains file from pillar

This commit is contained in:
Daniel Oetken 2016-05-18 18:38:46 +02:00
parent 99d7f9b6fd
commit 8c4c5e7a0a
3 changed files with 15 additions and 0 deletions

View File

@ -9,6 +9,9 @@ postfix:
- someuser_2@example.com
singlealiasexample: 'someuser_3@example.com'
relay_domains:
example.com: 'OK'
sasl_passwd:
smtp.example.com: 'somepassword'

View File

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

7
postfix/relay_domains Normal file
View File

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