From 755c7b64ba1873edf1178cfc28fe7500dda08060 Mon Sep 17 00:00:00 2001 From: skyler Date: Tue, 19 Aug 2014 18:42:08 -0700 Subject: [PATCH] Make postfix.config state work with latest changes --- postfix/config.sls | 6 ++++-- postfix/files/main.cf | 8 ++++++++ postfix/init.sls | 12 ------------ postfix/main.cf | 45 ------------------------------------------- 4 files changed, 12 insertions(+), 59 deletions(-) delete mode 100644 postfix/main.cf diff --git a/postfix/config.sls b/postfix/config.sls index f2e83b0..b52f270 100644 --- a/postfix/config.sls +++ b/postfix/config.sls @@ -15,6 +15,8 @@ include: - user: root - group: root - mode: 644 + - require: + - pkg: postfix - watch_in: service: postfix - template: jinja @@ -32,10 +34,10 @@ include: smtpd_tls_session_cache_database: {{ salt['pillar.get']('postfix:smtpd_tls_session_cache_database', 'btree:${data_directory}/smtpd_scache' )}} smtp_tls_session_cache_database: {{ salt['pillar.get']('postfix:smtp_tls_session_cache_database', 'btree:${data_directory}/smtp_scache' )}} - myhostname: {{ salt['pillar.get']('postfix:myhostname', 'localhost' )}} + myhostname: {{ salt['pillar.get']('postfix:myhostname', grains['fqdn'] )}} alias_maps: {{ salt['pillar.get']('postfix:alias_maps', 'hash:/etc/aliases' )}} alias_database: {{ salt['pillar.get']('postfix:alias_database', 'hash:/etc/aliases' )}} - mydestination: {{ salt['pillar.get']('postfix:mydestination', 'localhost, localhost.localdomain, , localhost' )}} + mydestination: {{ salt['pillar.get']('postfix:mydestination', grains['fqdn'] + ', localhost.localdomain, ' + grains['domain'] )}} relayhost: {{ salt['pillar.get']('postfix:relayhost', '' )}} mynetworks: {{ salt['pillar.get']('postfix:mynetworks', '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128' )}} mailbox_size_limit: {{ salt['pillar.get']('postfix:mailbox_size_limit', '0' )}} diff --git a/postfix/files/main.cf b/postfix/files/main.cf index fc73480..7a093ca 100644 --- a/postfix/files/main.cf +++ b/postfix/files/main.cf @@ -1,3 +1,4 @@ +# Managed by config management # See /usr/share/postfix/main.cf.dist for a commented, more complete version @@ -36,3 +37,10 @@ mynetworks = {{ mynetworks }} mailbox_size_limit = {{ mailbox_size_limit }} recipient_delimiter = {{ recipient_delimiter }} inet_interfaces = {{ inet_interfaces }} + +{% if 'virtual' in pillar.get('postfix','') %} +virtual_alias_maps = hash:/etc/postfix/virtual +{% endif %} + +#TODO: move into a pillar +message_size_limit = 41943040 diff --git a/postfix/init.sls b/postfix/init.sls index d154361..e5e4ae5 100644 --- a/postfix/init.sls +++ b/postfix/init.sls @@ -7,18 +7,6 @@ postfix: - pkg: postfix - watch: - pkg: postfix - - file: /etc/postfix/main.cf - -# postfix main configuration file -/etc/postfix/main.cf: - file.managed: - - source: salt://postfix/main.cf - - user: root - - group: root - - mode: 644 - - template: jinja - - require: - - pkg: postfix # manage /etc/aliases if data found in pillar {% if 'aliases' in pillar.get('postfix', '') %} diff --git a/postfix/main.cf b/postfix/main.cf deleted file mode 100644 index d2885db..0000000 --- a/postfix/main.cf +++ /dev/null @@ -1,45 +0,0 @@ -# Managed by config management -# See /usr/share/postfix/main.cf.dist for a commented, more complete version - -# Debian specific: Specifying a file name will cause the first -# line of that file to be used as the name. The Debian default -# is /etc/mailname. -#myorigin = /etc/mailname - -smtpd_banner = $myhostname ESMTP $mail_name -biff = no - -# appending .domain is the MUA's job. -append_dot_mydomain = no - -# Uncomment the next line to generate "delayed mail" warnings -#delay_warning_time = 4h - -readme_directory = no - -# TLS parameters -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 - -# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for -# information on enabling SSL in the smtp client. - -myhostname = {{ grains['fqdn'] }} -alias_maps = hash:/etc/aliases -alias_database = hash:/etc/aliases -mydestination = {{ grains['fqdn'] }}, localhost, {{ grains['domain'] }} -relayhost = -mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 -mailbox_size_limit = 0 -recipient_delimiter = + -inet_interfaces = all - -{% if 'virtual' in pillar.get('postfix','') %} -virtual_alias_maps = hash:/etc/postfix/virtual -{% endif %} - -#TODO: move into a pillar -message_size_limit = 41943040