2017-05-18 21:24:15 +00:00
|
|
|
---
|
2024-02-18 11:42:08 +00:00
|
|
|
- name: Configure postfix
|
|
|
|
ansible.builtin.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
|
|
|
|
2024-02-18 11:42:08 +00:00
|
|
|
- name: Create sasl_passwd file
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: etc/postfix/sasl_passwd.j2
|
|
|
|
dest: /etc/postfix/sasl_passwd
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0600"
|
|
|
|
register: __sasl_result
|
2017-05-18 21:24:15 +00:00
|
|
|
|
2024-02-18 11:42:08 +00:00
|
|
|
- name: Ensure sasl_passwd.db exist
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: /etc/postfix/sasl_passwd.db
|
|
|
|
register: __sasldb
|
2017-05-18 21:24:15 +00:00
|
|
|
|
2024-02-18 11:42:08 +00:00
|
|
|
- name: Create sasl_passwd.db
|
|
|
|
ansible.builtin.command: /usr/sbin/postmap hash:/etc/postfix/sasl_passwd
|
|
|
|
when: not __sasldb.stat.exists or __sasl_result.changed
|
|
|
|
notify: __postfix_restart
|
2017-05-18 21:24:15 +00:00
|
|
|
|
2024-02-18 11:42:08 +00:00
|
|
|
- name: Set permissions for sasl_passwd.db
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /etc/postfix/sasl_passwd.db
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0600"
|
|
|
|
notify: __postfix_restart
|
2017-05-18 21:24:15 +00:00
|
|
|
|
2024-02-18 11:42:08 +00:00
|
|
|
- name: Override outgoing header
|
|
|
|
ansible.builtin.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
|
|
|
|
2024-02-18 11:42:08 +00:00
|
|
|
- name: Ensure sender_canonical.db exist
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: /etc/postfix/sender_canonical.db
|
|
|
|
register: __senderdb
|
2017-05-18 21:24:15 +00:00
|
|
|
|
2024-02-18 11:42:08 +00:00
|
|
|
- name: Hash sender_canoncial
|
|
|
|
ansible.builtin.command: "/usr/sbin/postmap hash:/etc/postfix/sender_canonical"
|
|
|
|
when: not __senderdb.stat.exists or __sender_result.changed
|
|
|
|
notify: __postfix_restart
|