v0.1 done: docker webhosts, smtp gateway
This commit is contained in:
5
roles/smtpgateway/defaults/main.yaml
Normal file
5
roles/smtpgateway/defaults/main.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
postfix_relayhost: 'smtp.sendgrid.net'
|
||||
external_domain: 'kmlabz.com'
|
||||
username: lofasz
|
||||
password: lofasz
|
27
roles/smtpgateway/tasks/postfix.yaml
Normal file
27
roles/smtpgateway/tasks/postfix.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
- name: "Install Postfix via apt"
|
||||
apt:
|
||||
update_cache: yes
|
||||
state: present
|
||||
name:
|
||||
- postfix
|
||||
|
||||
- name: Install Postfix SASL credentials
|
||||
template:
|
||||
src: templates/sasl_passwd
|
||||
mode: 600
|
||||
dest: /etc/postfix/sasl_passwd
|
||||
|
||||
- name: Install Postfix mail gateway config
|
||||
template:
|
||||
src: templates/main.cf
|
||||
dest: /etc/postfix/main.cf
|
||||
|
||||
- name: Build hashtable of SASL creds
|
||||
command: postmap /etc/postfix/sasl_passwd
|
||||
|
||||
- name: Restart Postfix
|
||||
service:
|
||||
name: postfix
|
||||
state: restarted
|
||||
enabled: yes
|
37
roles/smtpgateway/templates/main.cf
Normal file
37
roles/smtpgateway/templates/main.cf
Normal file
@ -0,0 +1,37 @@
|
||||
# {{ansible_managed}}
|
||||
|
||||
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
|
||||
biff = no
|
||||
|
||||
append_dot_mydomain = no
|
||||
|
||||
readme_directory = no
|
||||
|
||||
compatibility_level = 2
|
||||
|
||||
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
|
||||
smtpd_tls_security_level=may
|
||||
|
||||
smtp_tls_CApath=/etc/ssl/certs
|
||||
smtp_sasl_auth_enable = yes
|
||||
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
|
||||
smtp_sasl_security_options = noanonymous
|
||||
smtp_sasl_tls_security_options = noanonymous
|
||||
smtp_tls_security_level = encrypt
|
||||
header_size_limit = 4096000
|
||||
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
||||
|
||||
|
||||
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
||||
myhostname = {{ansible_hostname}}.{{external_domain}}
|
||||
alias_maps = hash:/etc/aliases
|
||||
alias_database = hash:/etc/aliases
|
||||
myorigin = /etc/mailname
|
||||
mydestination = {{ansible_hostname}}.{{external_domain}}, $myhostname, {{ansible_hostname}}, localhost.localdomain, localhost
|
||||
relayhost = {{postfix_relayhost}}
|
||||
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
|
||||
mailbox_size_limit = 0
|
||||
recipient_delimiter = +
|
||||
inet_interfaces = all
|
||||
inet_protocols = all
|
1
roles/smtpgateway/templates/sasl_passwd
Normal file
1
roles/smtpgateway/templates/sasl_passwd
Normal file
@ -0,0 +1 @@
|
||||
[{{postfix_relayhost}}:587 {{username}}:{{password}}
|
Reference in New Issue
Block a user