blob: 163e10d0d1c46dcabb40f9eb9473b0a65e382b9d (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
- name: Install Dovecot
apt: pkg={{ item }}
with_items:
- dovecot-core
- dovecot-ldap
- dovecot-imapd
- dovecot-lmtpd
- dovecot-antispam
- dovecot-managesieved
- dovecot-sieve
- name: Create a user 'vmail'
user: name=vmail system=yes
home=/home/mail
shell=/bin/false
password=!
state=present
- name: Create a home directory for user 'vmail'
file: path=/home/mail
state=directory
owner=vmail group=vmail
mode=0700
- name: Create virtual mailbox directories
file: path=/etc/dovecot/virtual{{ item }}
state=directory
owner=root group=root
mode=0755
with_items:
- /
- /all
- /flagged
- /recent
- /unseen
- name: Create virtual mailboxes
copy: src=etc/dovecot/virtual/{{ item }}/dovecot-virtual
dest=/etc/dovecot/virtual/{{ item }}/dovecot-virtual
owner=root group=root
mode=0644
with_items:
- all
- flagged
- recent
- unseen
- name: Create directory /home/mail/spamspool
# There is no possibility for a name clash, since 'spamspool' isn't a
# valid domain
file: path=/home/mail/spamspool
state=directory
owner=vmail group=vmail
mode=0700
- name: Configure Dovecot
copy: src=etc/dovecot/{{ item }}
dest=/etc/dovecot/{{ item }}
owner=root group=root
mode=0644
register: r
with_items:
- conf.d/10-auth.conf
- conf.d/10-logging.conf
- conf.d/10-mail.conf
- conf.d/10-master.conf
- conf.d/10-ssl.conf
- conf.d/15-mailboxes.conf
- conf.d/20-imap.conf
- conf.d/20-lmtp.conf
- conf.d/90-plugin.conf
- conf.d/90-sieve.conf
- conf.d/auth-ldap.conf.ext
- dovecot-ldap.conf.ext
- dovecot-ldap-userdb.conf.ext
notify:
- Restart Dovecot
- name: Start Dovecot
service: name=dovecot state=started
when: not r.changed
- meta: flush_handlers
|