Make postfix.config state work with latest changes

This commit is contained in:
skyler 2014-08-19 18:42:08 -07:00
parent 95c51ca57c
commit 755c7b64ba
4 changed files with 12 additions and 59 deletions

View File

@ -15,6 +15,8 @@ include:
- user: root - user: root
- group: root - group: root
- mode: 644 - mode: 644
- require:
- pkg: postfix
- watch_in: - watch_in:
service: postfix service: postfix
- template: jinja - 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' )}} 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' )}} 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_maps: {{ salt['pillar.get']('postfix:alias_maps', 'hash:/etc/aliases' )}}
alias_database: {{ salt['pillar.get']('postfix:alias_database', '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', '' )}} 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' )}} 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' )}} mailbox_size_limit: {{ salt['pillar.get']('postfix:mailbox_size_limit', '0' )}}

View File

@ -1,3 +1,4 @@
# Managed by config management
# See /usr/share/postfix/main.cf.dist for a commented, more complete version # 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 }} mailbox_size_limit = {{ mailbox_size_limit }}
recipient_delimiter = {{ recipient_delimiter }} recipient_delimiter = {{ recipient_delimiter }}
inet_interfaces = {{ inet_interfaces }} 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

View File

@ -7,18 +7,6 @@ postfix:
- pkg: postfix - pkg: postfix
- watch: - watch:
- pkg: postfix - 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 # manage /etc/aliases if data found in pillar
{% if 'aliases' in pillar.get('postfix', '') %} {% if 'aliases' in pillar.get('postfix', '') %}

View File

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