Ajout des relais SMTP pour que tous les systèmes puissent communiquer
This commit is contained in:
8
roles/smtprelay/handlers/main.yml
Normal file
8
roles/smtprelay/handlers/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
- name: restart postfix
|
||||
service:
|
||||
name: postfix
|
||||
state: restarted
|
||||
|
||||
- name: postmap sasl_passwd
|
||||
command: postmap /etc/postfix/sasl_passwd
|
||||
|
25
roles/smtprelay/tasks/main.yml
Normal file
25
roles/smtprelay/tasks/main.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
- name: install postfix smtp server
|
||||
package:
|
||||
name: postfix
|
||||
state: present
|
||||
|
||||
- name: install libsasl2
|
||||
package:
|
||||
name: libsasl2-modules
|
||||
state: present
|
||||
|
||||
- name: install sasl_passwd file
|
||||
template:
|
||||
src: sasl_passwd.j2
|
||||
dest: /etc/postfix/sasl_passwd
|
||||
mode: 0640
|
||||
notify:
|
||||
- postmap sasl_passwd
|
||||
- restart postfix
|
||||
|
||||
- name: install default postfix main.cf
|
||||
template:
|
||||
src: main.cf.j2
|
||||
dest: /etc/postfix/main.cf
|
||||
mode: 0644
|
||||
notify: restart postfix
|
26
roles/smtprelay/templates/main.cf.j2
Normal file
26
roles/smtprelay/templates/main.cf.j2
Normal file
@@ -0,0 +1,26 @@
|
||||
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
|
||||
biff = no
|
||||
|
||||
# appending .domain is the MUA's job.
|
||||
append_dot_mydomain = no
|
||||
myorigin = mateu.be
|
||||
|
||||
# Uncomment the next line to generate "delayed mail" warnings
|
||||
#delay_warning_time = 4h
|
||||
|
||||
alias_maps = hash:/etc/aliases
|
||||
alias_database = hash:/etc/aliases
|
||||
mydestination = $myhostname, localhost.$mydomain, localhost
|
||||
|
||||
## sending email
|
||||
smtp_sasl_auth_enable = yes
|
||||
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
|
||||
smtp_sasl_security_options = noanonymous
|
||||
smtp_use_tls = yes
|
||||
relayhost = [smtp.libertus.eu]:587
|
||||
|
||||
## only accepts local relay
|
||||
mynetworks = 127.0.0.0/8, 172.17.0.1/16
|
||||
inet_interfaces = loopback-only
|
||||
|
||||
smtpd_relay_restrictions = permit_mynetworks,defer_unauth_destination,reject
|
1
roles/smtprelay/templates/sasl_passwd.j2
Normal file
1
roles/smtprelay/templates/sasl_passwd.j2
Normal file
@@ -0,0 +1 @@
|
||||
[smtp.libertus.eu]:587 smtp.relay:{{ smtp_relay_pass }}
|
Reference in New Issue
Block a user