From 49122136948228ebbf49c701d4a4e5e842d1a3e8 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 4 May 2018 15:20:52 +0200 Subject: [PATCH] library/roles/postfix-relay/tasks/postfix-relay-server.yml: Fix the saslauthd configuration on Ubuntu xenial. --- postfix-relay/tasks/postfix-relay-server.yml | 40 +++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/postfix-relay/tasks/postfix-relay-server.yml b/postfix-relay/tasks/postfix-relay-server.yml index 7a223a38..3e0f03ad 100644 --- a/postfix-relay/tasks/postfix-relay-server.yml +++ b/postfix-relay/tasks/postfix-relay-server.yml @@ -1,41 +1,45 @@ --- +- name: Create the /etc/mailname file if it's not present + template: src=mailname.j2 dest=/etc/mailname owner=root group=root mode=0644 + tags: postfix-relay + - name: Write the network hash file template: src=network_table.j2 dest=/etc/postfix/network_table owner=root group=root mode=0444 notify: Update the network hash table - tags: - - postfix-relay + tags: postfix-relay - name: Install the sasl2 authentication infrastructure apt: pkg={{ item }} state=installed with_items: '{{ postfix_sasl_packages }}' - tags: - - postfix-relay + tags: postfix-relay - name: Create the sasl directory inside /etc/postfix file: dest=/etc/postfix/sasl state=directory owner=root group=root mode=0555 - tags: - - postfix-relay + tags: postfix-relay + +- name: Create the sasl run directory inside /var/spool/postfix, for chroot + file: dest=/var/spool/postfix/var/run/saslauthd state=directory owner=root group=root mode=0555 + notify: start saslauth daemon + 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 - tags: - - postfix-relay - -- name: Enable the saslauth daemon - action: configfile path=/etc/default/saslauthd key=START value='yes' syntax=shell - notify: start saslauth daemon - tags: - - postfix-relay + 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 notify: restart saslauth daemon - tags: - - postfix-relay + tags: postfix-relay + +- name: Enable the saslauth daemon + action: configfile path=/etc/default/saslauthd key=START value='yes' syntax=shell + 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' notify: Restart postfix - tags: - - postfix-relay + tags: postfix-relay +- name: Ensure that the saslauthd daemon is started and enabled + service: name=saslauthd state=restarted enabled=yes + tags: postfix-relay