start dovecot config; generate postfix transport_map; support multiple sender IPs...
[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=
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   - dovecot-sql.conf.ext
38 - name: install quota notification script
39   template:
40     dest: /etc/dovecot/quota-warning.sh
41     src: templates/dovecot/quota-warning.sh
42     mode: +x