xoxys.postfix_relay/tasks/config.yml

58 lines
1.3 KiB
YAML
Raw Normal View History

2017-05-18 21:24:15 +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
- name: create sasl
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: sasldb.stat.exists == 'false' or sasl_result.changed
register: sasldb_update
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: senderdb.stat.exists == false or sender_result.changed
register: senderdb_update
notify: postfix_restart