From 493298fff180ef7e35c5d8aa9ba81799090a186a Mon Sep 17 00:00:00 2001 From: jeroen92 Date: Wed, 25 Mar 2015 12:49:57 +0100 Subject: [PATCH 1/2] Add option to let the module (not) manage the master.cf --- pillar.example | 38 ++++++++++++++++++++------------------ postfix/config.sls | 4 ++-- postfix/files/main.cf | 2 +- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/pillar.example b/pillar.example index ed2d425..e3239d8 100644 --- a/pillar.example +++ b/pillar.example @@ -1,23 +1,25 @@ postfix: - smtpd_banner: $myhostname ESMTP $mail_name - biff: 'no' + manage_master_config: True + config: + smtpd_banner: $myhostname ESMTP $mail_name + biff: 'no' - append_dot_mydomain: 'no' + append_dot_mydomain: 'no' - readme_directory: 'no' + readme_directory: 'no' - smtpd_tls_cert_file: /etc/ssl/certs/ssl-cert-snakeoil.pem - smtpd_tls_key_file: /etc/ssl/private/ssl-cert-snakeoil.key - smtpd_use_tls: 'yes' - smtpd_tls_session_cache_database: btree:${data_directory}/smtpd_scache - smtp_tls_session_cache_database: btree:${data_directory}/smtp_scache + smtpd_tls_cert_file: /etc/ssl/certs/ssl-cert-snakeoil.pem + smtpd_tls_key_file: /etc/ssl/private/ssl-cert-snakeoil.key + smtpd_use_tls: 'yes' + smtpd_tls_session_cache_database: btree:${data_directory}/smtpd_scache + smtp_tls_session_cache_database: btree:${data_directory}/smtp_scache - myhostname: localhost - alias_maps: hash:/etc/aliases - alias_database: hash:/etc/aliases - mydestination: localhost, localhost.localdomain - relayhost: - mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 - mailbox_size_limit: 0 - recipient_delimiter: + - inet_interfaces: all + myhostname: localhost + alias_maps: hash:/etc/aliases + alias_database: hash:/etc/aliases + mydestination: localhost, localhost.localdomain + relayhost: + mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 + mailbox_size_limit: 0 + recipient_delimiter: + + inet_interfaces: all diff --git a/postfix/config.sls b/postfix/config.sls index 3c11d4e..cc98624 100644 --- a/postfix/config.sls +++ b/postfix/config.sls @@ -20,7 +20,7 @@ include: - watch_in: - service: postfix - template: jinja - +{% if salt['pillar.get']('postfix:manage_master_config', True) == True %} /etc/postfix/master.cf: file.managed: - source: salt://postfix/files/master.cf @@ -32,4 +32,4 @@ include: - watch_in: - service: postfix - template: jinja - +{% endif %} diff --git a/postfix/files/main.cf b/postfix/files/main.cf index 2ff9d80..e96116f 100644 --- a/postfix/files/main.cf +++ b/postfix/files/main.cf @@ -1,4 +1,4 @@ -{% set config = salt['pillar.get']('postfix', {}) -%} +{% set config = salt['pillar.get']('postfix:config', {}) -%} {% set processed_parameters = ['aliases', 'virtual'] -%} {% macro set_parameter(parameter, default=None) -%} {% set value = config.get(parameter, default) -%} From f8cbffc6205089d28f307fc67a8d602c19d62850 Mon Sep 17 00:00:00 2001 From: jeroen92 Date: Thu, 26 Mar 2015 09:43:44 +0100 Subject: [PATCH 2/2] Optimized manage_master_config conditional --- postfix/config.sls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postfix/config.sls b/postfix/config.sls index cc98624..ef4e9ec 100644 --- a/postfix/config.sls +++ b/postfix/config.sls @@ -20,7 +20,7 @@ include: - watch_in: - service: postfix - template: jinja -{% if salt['pillar.get']('postfix:manage_master_config', True) == True %} +{% if salt['pillar.get']('postfix:manage_master_config', True) %} /etc/postfix/master.cf: file.managed: - source: salt://postfix/files/master.cf