summaryrefslogtreecommitdiff
path: root/roles/mail/postfix/submission/tasks/saslauthd.yml
blob: 065fb255b687d2f69de37af4ca51add0b7f6fff1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
- 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