letsencrypt now generates certificates that include the chain
[ansible.git] / roles / email / tasks / dovecot.yml
1 - name: install dovecot
2   apt: name=dovecot-imapd,dovecot-lmtpd,dovecot-mysql,dovecot-pop3d,dovecot-sieve,dovecot-managesieved state=latest
3 - name: enable dovecot
4   service: name=dovecot enabled=yes
5 # configuration
6 - name: check mail group
7   shell: "test \"$(id -g mail)\" -eq '{{postfix.dovecot.mail_gid}}'"
8   changed_when: "False"
9 - name: create vmail user
10   user:
11     name: vmail
12     group: mail
13     uid: "{{postfix.dovecot.vmail_uid}}"
14     shell: /bin/false
15     home: /var/vmail
16     create_home: no
17     system: yes
18 - name: create vmail dir
19   file: name=/var/vmail state=directory owner=vmail group=mail
20 - name: configure dovecot
21   notify: dovecot
22   template:
23     dest: /etc/dovecot/{{ item }}
24     src: templates/dovecot/{{ item }}
25     mode: u=rw,g=r,o=r # changepw needs read access
26     group: dovecot
27   loop:
28   - conf.d/10-auth.conf
29   - conf.d/10-mail.conf
30   - conf.d/10-master.conf
31   - conf.d/10-ssl.conf
32   - conf.d/15-lda.conf
33   - conf.d/20-imap.conf
34   - conf.d/20-lmtp.conf
35   - conf.d/90-quota.conf
36   - conf.d/auth-sql.conf.ext
37 - name: configure dovecot secrets
38   notify: dovecot
39   template:
40     dest: /etc/dovecot/{{ item }}
41     src: templates/dovecot/{{ item }}
42     mode: u=rw,g=r,o=
43     group: dovecot
44   loop:
45   - dovecot-sql.conf.ext
46 - name: install quota notification script
47   template:
48     dest: /etc/dovecot/quota-warning.sh
49     src: templates/dovecot/quota-warning.sh
50     mode: +x
51 # scripts
52 - name: create newmail dir
53   file: path=/root/newmail state=directory
54 - name: install newmail script
55   template:
56     dest: /root/newmail/newmail
57     src: templates/newmail/newmail
58     mode: u=rwx,g=rx,o=rx
59 - name: install newmail config
60   template:
61     dest: /root/newmail/{{ item }}
62     src: templates/newmail/{{ item }}
63   loop:
64   - templates.py
65   - settings.py
66 - name: install changepw script
67   when: postfix.dovecot.changepw_cgi is defined
68   template:
69     dest: "{{postfix.dovecot.changepw_cgi}}"
70     src: templates/changepw
71     mode: u=rwx,g=rx,o=