6e1b12a3a7c2236426afd9fadf3575ef2afd1c88
[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
43 # scripts
44 - name: create newmail dir
45   file: path=/root/newmail state=directory
46 - name: install newmail script
47   template:
48     dest: /root/newmail/newmail
49     src: templates/newmail/newmail
50     mode: u=rwx,g=rx,o=rx
51 - name: install newmail config
52   template:
53     dest: /root/newmail/{{ item }}
54     src: templates/newmail/{{ item }}
55   loop:
56   - templates.py
57   - settings.py
58 - name: install changepw script
59   when: postfix.dovecot.changepw_cgi is defined
60   template:
61     dest: "{{postfix.dovecot.changepw_cgi}}"
62     src: templates/changepw
63     mode: u=rwx,g=rx,o=