xoxys.postfix_relay/tasks/config_default.yml

60 lines
1.5 KiB
YAML
Raw Normal View History

2017-05-18 21:24:15 +00:00
---
2019-08-24 13:01:30 +00:00
- block:
2019-01-09 19:53:40 +00:00
- name: Configure postfix
template:
src: etc/postfix/main.cf.j2
dest: /etc/postfix/main.cf
owner: root
group: root
mode: 0644
notify: __postfix_restart
2017-05-18 21:24:15 +00:00
2019-08-24 13:01:30 +00:00
- name: Create sasl_passwd file
2019-01-09 19:53:40 +00:00
template:
src: etc/postfix/sasl_passwd.j2
dest: /etc/postfix/sasl_passwd
owner: root
group: root
mode: 0600
2019-08-24 13:01:30 +00:00
register: __sasl_result
2017-05-18 21:24:15 +00:00
2019-01-09 19:53:40 +00:00
- name: Ensure sasl_passwd.db exist
stat:
path: /etc/postfix/sasl_passwd.db
2019-08-24 13:01:30 +00:00
register: __sasldb
2017-05-18 21:24:15 +00:00
2019-01-09 19:53:40 +00:00
- name: Create sasl_passwd.db
command: /usr/sbin/postmap hash:/etc/postfix/sasl_passwd
2019-08-24 13:01:30 +00:00
when: not __sasldb.stat.exists or __sasl_result.changed
notify: __postfix_restart
2017-05-18 21:24:15 +00:00
2019-01-09 19:53:40 +00:00
- name: Set permissions for sasl_passwd.db
file:
path: /etc/postfix/sasl_passwd.db
owner: root
group: root
mode: 0600
notify: __postfix_restart
2017-05-18 21:24:15 +00:00
2019-01-09 19:53:40 +00:00
- name: Override outgoing header
template:
src: etc/postfix/sender_canonical.j2
dest: /etc/postfix/sender_canonical
owner: root
group: root
mode: 0600
register: sender_result
2017-05-18 21:24:15 +00:00
2019-01-09 19:53:40 +00:00
- name: Ensure sender_canonical.db exist
stat:
path: /etc/postfix/sender_canonical.db
register: senderdb
2017-05-18 21:24:15 +00:00
2019-01-09 19:53:40 +00:00
- name: Hash sender_canoncial
command: "/usr/sbin/postmap hash:/etc/postfix/sender_canonical"
when: not senderdb.stat.exists or sender_result.changed
register: senderdb_update
notify: __postfix_restart
2018-07-06 21:13:11 +00:00
become: True
2019-01-09 19:53:40 +00:00
become_user: root