ansible-roles/postfix-relay/tasks/postfix-relay-server.yml

56 lines
1.8 KiB
YAML

---
- name: Write the network hash file
template: src=network_table.j2 dest=/etc/postfix/network_table owner=root group=root mode=0444
when: postfix_relay_server
notify: Update the network hash table
tags:
- postfix-relay
- name: Activate the submission port on the postfix master file
template: src=postfix-master.cf.j2 dest=/etc/postfix/master.cf owner=root group=root mode=0444
when: postfix_relay_server
notify: Restart postfix
tags:
- postfix-relay
- name: Install the sasl2 authentication infrastructure
apt: pkg={{ item }} state=installed
with_items: postfix_sasl_packages
when: postfix_relay_server
tags:
- postfix-relay
- name: Create the sasl directory inside /etc/postfix
file: dest=/etc/postfix/sasl state=directory owner=root group=root mode=0555
when: postfix_relay_server
tags:
- postfix-relay
- name: Install the smtpd.conf file inside inside /etc/postfix/sasl
copy: src=sasl_smtpd.conf dest=/etc/postfix/sasl/smtpd.conf owner=root group=root mode=0444
when: postfix_relay_server
tags:
- postfix-relay
- name: Enable the saslauth daemon
action: configfile path=/etc/default/saslauthd key=START value='yes' syntax=shell
when: postfix_relay_server
notify: start saslauth daemon
tags:
- postfix-relay
- name: Change the socket path because postfix on debian runs inside a chroot jail
action: configfile path=/etc/default/saslauthd key=OPTIONS value='"-c -m /var/spool/postfix/var/run/saslauthd"' syntax=shell
when: postfix_relay_server
notify: restart saslauth daemon
tags:
- postfix-relay
- name: Assign the sasl group to the postfix user so that postfix can use the saslauthd socket
user: name=postfix groups='sasl'
when: postfix_relay_server
notify: Restart postfix
tags:
- postfix-relay