Add postfix config
This commit is contained in:
parent
edaa30868d
commit
930f7c4974
4 changed files with 29 additions and 0 deletions
|
@ -2,3 +2,8 @@
|
||||||
- name: Reload systemd daemon
|
- name: Reload systemd daemon
|
||||||
systemd:
|
systemd:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
|
- name: Restart postfix
|
||||||
|
service:
|
||||||
|
name: postfix
|
||||||
|
state: restarted
|
||||||
|
|
16
tasks/configure_postfix.yml
Normal file
16
tasks/configure_postfix.yml
Normal 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
|
||||||
|
|
||||||
|
|
|
@ -21,3 +21,6 @@
|
||||||
|
|
||||||
- name: Ensure user's are configured in dbmail
|
- name: Ensure user's are configured in dbmail
|
||||||
include_tasks: configure_dbmail_users.yml
|
include_tasks: configure_dbmail_users.yml
|
||||||
|
|
||||||
|
- name: Ensure postfix is configured for dbmail
|
||||||
|
include_tasks: configure_postfix.yml
|
||||||
|
|
5
templates/mysql-virtual_forwardings_dbmail.cf.j2
Normal file
5
templates/mysql-virtual_forwardings_dbmail.cf.j2
Normal 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
|
Loading…
Reference in a new issue