--- - name: install saslauthd and sasl-modules apt: name: - sasl2-bin - libsasl2-modules state: present - name: basic saslauthd options vars: saslauthd_options: START: "yes" MECHANISMS: "{{ postfix_submission_auth_saslauthd.mechanism }}" OPTIONS: "-c -m /var/spool/postfix/saslauthd" loop: "{{ saslauthd_options | dict2items }}" loop_control: label: "{{ item.key }} = {{ item.value }}" lineinfile: regexp: '^#?\s*{{ item.key }}\s*=' line: '{{ item.key }}="{{ item.value }}"' dest: /etc/default/saslauthd notify: restart saslauthd - name: configure saslauthd mechanism include_tasks: "saslauthd-{{ postfix_submission_auth_saslauthd.mechanism }}.yml" - name: configure postfix sasl via saslauthd copy: content: | pwcheck_method: saslauthd saslauthd_path: /saslauthd/mux mech_list: plain login dest: /etc/postfix/sasl/submission.conf notify: restart postfix - name: add postfix user to sasl group user: name: postfix groups: sasl append: yes notify: restart postfix - name: make sure saslauthd service is enabled and started systemd: daemon_reload: yes name: saslauthd.service enabled: yes state: started