refactor common role
This commit is contained in:
2
roles/common/templates/postfix/aliases.j2
Normal file
2
roles/common/templates/postfix/aliases.j2
Normal file
@@ -0,0 +1,2 @@
|
||||
root: {{ smtp_default_recipient }}
|
||||
postmaster: {{ smtp_default_recipient }}
|
||||
40
roles/common/templates/postfix/main.cf.j2
Normal file
40
roles/common/templates/postfix/main.cf.j2
Normal file
@@ -0,0 +1,40 @@
|
||||
{{ ansible_managed | comment }}
|
||||
|
||||
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
|
||||
|
||||
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
|
||||
# fresh installs.
|
||||
compatibility_level = 2
|
||||
|
||||
biff = no
|
||||
recipient_delimiter = +
|
||||
readme_directory = no
|
||||
# appending .domain is the MUA's job.
|
||||
append_dot_mydomain = no
|
||||
|
||||
# rewrite sender address
|
||||
sender_canonical_maps = hash:{{ postfix_senders_map_path }}
|
||||
|
||||
alias_maps = hash:{{ smtp_aliases_path }}
|
||||
alias_database = hash:{{ smtp_aliases_path }}
|
||||
|
||||
myhostname = {{ ansible_hostname }}
|
||||
myorigin = $myhostname
|
||||
mydestination = $myhostname, localhost.localdomain, localhost
|
||||
mynetworks_style = host
|
||||
|
||||
inet_interfaces = all
|
||||
inet_protocols = all
|
||||
|
||||
relayhost = [{{ smtp_accounts[smtp_default_account].host }}]
|
||||
relay_domains =
|
||||
# enable SASL authentication
|
||||
smtp_sasl_auth_enable = yes
|
||||
# disallow methods that allow anonymous authentication.
|
||||
smtp_sasl_security_options = noanonymous
|
||||
# where to find sasl_passwd
|
||||
smtp_sasl_password_maps = hash:{{ postfix_sasl_secrets_path }}
|
||||
# Enable STARTTLS encryption
|
||||
smtp_use_tls = yes
|
||||
# where to find CA certificates
|
||||
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
|
||||
3
roles/common/templates/postfix/sasl_secrets.j2
Normal file
3
roles/common/templates/postfix/sasl_secrets.j2
Normal file
@@ -0,0 +1,3 @@
|
||||
{% for account in smtp_accounts.values() %}
|
||||
[{{ account.host }}] {{ account.username }}:{{ account.password }}
|
||||
{% endfor %}
|
||||
3
roles/common/templates/postfix/senders.j2
Normal file
3
roles/common/templates/postfix/senders.j2
Normal file
@@ -0,0 +1,3 @@
|
||||
{% if smtp_accounts[smtp_default_account].from is defined %}
|
||||
@{{ ansible_hostname }} {{ smtp_accounts[smtp_default_account].from }}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user