From 8c4c5e7a0a5784011a589598cc3256f7d81ecfd5 Mon Sep 17 00:00:00 2001 From: Daniel Oetken Date: Wed, 18 May 2016 18:38:46 +0200 Subject: [PATCH] manage relay_domains file from pillar --- pillar.example | 3 +++ postfix/init.sls | 5 +++++ postfix/relay_domains | 7 +++++++ 3 files changed, 15 insertions(+) create mode 100644 postfix/relay_domains diff --git a/pillar.example b/pillar.example index 5663fcf..2850efe 100644 --- a/pillar.example +++ b/pillar.example @@ -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' diff --git a/postfix/init.sls b/postfix/init.sls index 167f8fb..c86446f 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 %}