xoxys.postfix_relay/tasks/config_default.yml
Robert Kaussow ebc37d8f37
All checks were successful
continuous-integration/drone/push Build is passing
prefix internal vars
2020-11-23 22:11:27 +01:00

59 lines
1.5 KiB
YAML

---
- block:
- name: Configure postfix
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
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
stat:
path: /etc/postfix/sasl_passwd.db
register: __sasldb
- name: Create sasl_passwd.db
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
file:
path: /etc/postfix/sasl_passwd.db
owner: root
group: root
mode: 0600
notify: __postfix_restart
- 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
- name: Ensure sender_canonical.db exist
stat:
path: /etc/postfix/sender_canonical.db
register: __senderdb
- name: Hash sender_canoncial
command: "/usr/sbin/postmap hash:/etc/postfix/sender_canonical"
when: not __senderdb.stat.exists or __sender_result.changed
notify: __postfix_restart
become: True
become_user: root