Setup main.cf for postfix role

This commit is contained in:
Tunui Franken 2025-01-19 22:26:36 +01:00
parent 9a777a5f13
commit 7da429b4b8
8 changed files with 66 additions and 0 deletions

View file

@ -2,3 +2,4 @@
icinga2_master: lime2
icinga2_agent: eumycota
mailserver: eumycota

View file

@ -2,3 +2,4 @@
icinga2_master: lime2-test
icinga2_agent: mailserver-test
mailserver: mailserver-test

View file

@ -65,6 +65,12 @@
name: postfix
state: restarted
- name: Reload postfix service
become: true
ansible.builtin.systemd:
name: postfix
state: reloaded
- name: Reload dovecot service
become: true
ansible.builtin.systemd:

View file

@ -0,0 +1,4 @@
---
icinga2_master: lime2-test
icinga2_agent: mailserver-test

View file

@ -1,4 +1,6 @@
---
icinga2_master: lime2-test
icinga2_agent: mailserver-test
icinga2_admin_mail: icinga@tunuifranken.info
icinga2_notification_from_mail: icinga@tunuifranken.info

View file

@ -0,0 +1,4 @@
---
mydomain: tunuifranken.info
mailserver: mailserver-test

View file

@ -4,3 +4,13 @@
become: true
ansible.builtin.apt:
name: postfix
- name: Copy main.cf
become: true
ansible.builtin.template:
src: main.cf.j2
dest: /etc/postfix/main.cf
owner: root
group: root
mode: 0644
notify: Reload postfix service

View file

@ -0,0 +1,38 @@
# {{ ansible_managed }}
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
readme_directory = no
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 3.6 on
# fresh installs.
compatibility_level = 3.6
myhostname = {{ ansible_hostname }}.{{ mydomain }}
mydomain = {{ mydomain }}
myorigin = $myhostname
mydestination = $myhostname localhost.$mydomain localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
relayhost = [{{ mailserver }}.{{ mydomain }}]:587
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
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
smtpd_tls_auth_only = yes
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache