summaryrefslogtreecommitdiffstats
path: root/roles/IMAP-proxy/tasks/main.yml
blob: bb6e5be10a1490cbcb7b239615a8861d5fac8a38 (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
- name: Install Dovecot
  #apt: pkg={{ item }} default_release={{ ansible_lsb.codename }}-backports
  apt: pkg={{ item }}
  with_items:
    - dovecot-core
    - dovecot-imapd

- name: Create a user 'imapproxy'
  user: name=imapproxy system=yes
        home=/home/imapproxy
        shell=/bin/false
        password=!
        state=present

- name: Create a home directory for user 'imapproxy'
  file: path=/home/imapproxy
        state=directory
        owner=imapproxy group=imapproxy
        mode=0700

- name: Configure Dovecot
  copy: src=etc/dovecot/conf.d/{{ item }}
        dest=/etc/dovecot/conf.d/{{ item }}
        owner=root group=root
        mode=0644
  register: r
  with_items:
    - 10-auth.conf
    - 10-logging.conf
    - 10-mail.conf
    - 10-master.conf
    - 15-mailboxes.conf
    - 20-imapc.conf
    - auth-imap.conf.ext
  notify:
    - Restart Dovecot

- name: Start Dovecot
  service: name=dovecot state=started
  when: not r.changed

- meta: flush_handlers