56 lines
1.4 KiB
YAML
56 lines
1.4 KiB
YAML
---
|
|
- 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
|
|
|
|
- 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
|
|
|
|
- name: Ensure sasl_passwd.db exist
|
|
ansible.builtin.stat:
|
|
path: /etc/postfix/sasl_passwd.db
|
|
register: __sasldb
|
|
|
|
- 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
|
|
|
|
- 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
|
|
|
|
- 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
|
|
|
|
- name: Ensure sender_canonical.db exist
|
|
ansible.builtin.stat:
|
|
path: /etc/postfix/sender_canonical.db
|
|
register: __senderdb
|
|
|
|
- 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
|