xoxys.postfix_relay/tasks/config.yml

58 lines
1.3 KiB
YAML
Raw Normal View History

2017-05-18 21:24:15 +00:00
---
2017-12-10 16:12:11 +00:00
- name: Configure postfix
2017-05-18 21:24:15 +00:00
template:
2018-06-24 12:27:19 +00:00
src: etc/postfix/main.cf.j2
dest: /etc/postfix/main.cf
2017-05-18 21:24:15 +00:00
owner: root
group: root
mode: 0644
notify: postfix_restart
2017-12-10 16:12:11 +00:00
- name: Create sasl
2017-05-18 21:24:15 +00:00
template:
2018-06-24 12:27:19 +00:00
src: etc/postfix/sasl_passwd.j2
dest: /etc/postfix/sasl_passwd
2017-05-18 21:24:15 +00:00
owner: root
group: root
mode: 0600
register: sasl_result
2017-12-10 16:12:11 +00:00
- name: Ensure sasl_passwd.db exist
2017-05-18 21:24:15 +00:00
stat:
2018-06-24 12:27:19 +00:00
path: /etc/postfix/sasl_passwd.db
2017-05-18 21:24:15 +00:00
register: sasldb
2017-12-10 16:12:11 +00:00
- name: Create sasl_passwd.db
2018-06-24 12:27:19 +00:00
command: /usr/sbin/postmap hash:/etc/postfix/sasl_passwd
when: not sasldb.stat.exists or sasl_result.changed
2017-05-18 21:24:15 +00:00
register: sasldb_update
notify: postfix_restart
2017-12-10 16:12:11 +00:00
- name: Set permissions for sasl_passwd.db
2017-05-18 21:24:15 +00:00
file:
2018-06-24 12:27:19 +00:00
path: /etc/postfix/sasl_passwd.db
2017-05-18 21:24:15 +00:00
owner: root
group: root
mode: 0600
notify: postfix_restart
2017-12-10 16:12:11 +00:00
- name: Override outgoing header
2017-05-18 21:24:15 +00:00
template:
2018-06-24 12:27:19 +00:00
src: etc/postfix/sender_canonical.j2
dest: /etc/postfix/sender_canonical
2017-05-18 21:24:15 +00:00
owner: root
group: root
mode: 0600
register: sender_result
2017-12-10 16:12:11 +00:00
- name: Ensure sender_canonical.db exist
2017-05-18 21:24:15 +00:00
stat:
2018-06-24 12:27:19 +00:00
path: /etc/postfix/sender_canonical.db
2017-05-18 21:24:15 +00:00
register: senderdb
2017-12-10 16:12:11 +00:00
- name: Hash sender_canoncial
2018-06-24 12:27:19 +00:00
command: "/usr/sbin/postmap hash:/etc/postfix/sender_canonical"
when: not senderdb.stat.exists or sender_result.changed
2017-05-18 21:24:15 +00:00
register: senderdb_update
2017-12-10 16:12:11 +00:00
notify: postfix_restart