summaryrefslogtreecommitdiffstats
path: root/roles/webmail/tasks/mail.yml
blob: 78eee382f8eb1342b8e50d7f8de3ca25add917ba (plain)
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
- name: Create /etc/stunnel/certs
  file: path=/etc/stunnel/certs
        state=directory
        owner=root group=root
        mode=0755

- name: Copy the SMTP outgoing proxy's X.509 certificate
  assemble: src=certs/postfix regexp="{{ groups.out | difference([inventory_hostname]) | join('|') }}\.pem$" remote_src=no
            dest=/etc/stunnel/certs/smtp.pem
            owner=root group=root
            mode=0644
  register: r1
  notify:
    - Restart stunnel@smtp

- name: Configure stunnel
  template: src=etc/stunnel/smtp.conf.j2
            dest=/etc/stunnel/smtp.conf
            owner=root group=root
            mode=0644
  register: r2
  notify:
    - Restart stunnel@smtp

- name: Enable stunnel@smtp
  service: name=stunnel4@smtp enabled=yes

- name: Start stunnel@smtp
  service: name=stunnel4@smtp state=started
  when: not (r1.changed or r2.changed)

- meta: flush_handlers