Add postfix config

This commit is contained in:
Antonio J. Delgado 2023-01-30 23:33:01 +02:00
parent edaa30868d
commit 930f7c4974
4 changed files with 29 additions and 0 deletions

View file

@ -2,3 +2,8 @@
- name: Reload systemd daemon
systemd:
daemon_reload: true
- name: Restart postfix
service:
name: postfix
state: restarted

View file

@ -0,0 +1,16 @@
---
- name: Create MySQL virtual forwardings map file
template:
path: /etc/postfix/mysql-virtual_forwardings_dbmail.cf
src: mysql-virtual_forwardings_dbmail.cf.j2
notify: Restart postfix
- name: Configure Postfix virtual mailbox maps
lineinfile:
path: /etc/postfix/main.cf
regexp: '^virtual_mailbox_domains = '
line: virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf proxy:mysql:/etc/postfix/mysql-virtual_forwardings_dbmail.cf
backup: true
notify: Restart postfix

View file

@ -21,3 +21,6 @@
- name: Ensure user's are configured in dbmail
include_tasks: configure_dbmail_users.yml
- name: Ensure postfix is configured for dbmail
include_tasks: configure_postfix.yml

View file

@ -0,0 +1,5 @@
user = {{ dbmail_db_user}}
password = {{ dbmail_db_password }}
dbname = {{ dbmail_db_name }}
query = SELECT DISTINCT 1 FROM dbmail_aliases WHERE SUBSTRING_INDEX(alias, '@', -1) = '%s';
hosts = 127.0.0.1