main.yml 2.13 KB
Newer Older
Hinrikus Wolf's avatar
Hinrikus Wolf committed
1
2
---

Hinrikus Wolf's avatar
Hinrikus Wolf committed
3
4
5
6
7
8
9
10
11
12
- name: ensure all required dovecot packages are installed
  apt: name={{ item }} state=present 
  with_items:
    - dovecot-core
    - dovecot-imapd
    - dovecot-lmtpd
    - dovecot-managesieved
    - dovecot-sieve
  tags: 
    - dovecot
Hinrikus Wolf's avatar
Hinrikus Wolf committed
13
    - mail
Hinrikus Wolf's avatar
Hinrikus Wolf committed
14
15
16
17

- name: ensure all configs are present
  template: src={{item.src}} dest={{item.dest}}
  with_items:
Hinrikus Wolf's avatar
Hinrikus Wolf committed
18
19
20
21
22
    - { src: 'templates/dovecot.conf.j2', dest: '/etc/dovecot/dovecot.conf' }
    - { src: 'templates/conf.d/10-auth.conf.j2', dest: '/etc/dovecot/conf.d/10-auth.conf' }
    - { src: 'templates/conf.d/10-mail.conf.j2', dest: '/etc/dovecot/conf.d/10-mail.conf' }
    - { src: 'templates/conf.d/10-master.conf.j2', dest: '/etc/dovecot/conf.d/10-master.conf' }
    - { src: 'templates/conf.d/10-ssl.conf.j2', dest: '/etc/dovecot/conf.d/10-ssl.conf' }
Hinrikus Wolf's avatar
Hinrikus Wolf committed
23
    - { src: 'templates/conf.d/20-managesieve.conf.j2', dest: '/etc/dovecot/conf.d/20-managesieve.conf' }
Hinrikus Wolf's avatar
Hinrikus Wolf committed
24
    - { src: 'templates/conf.d/20-imap.conf.j2', dest: '/etc/dovecot/conf.d/20-imap.conf' }
Hinrikus Wolf's avatar
Hinrikus Wolf committed
25
    - { src: 'templates/conf.d/20-lmtp.conf.j2', dest: '/etc/dovecot/conf.d/20-lmtp.conf' }
Hinrikus Wolf's avatar
Hinrikus Wolf committed
26
    - { src: 'templates/conf.d/90-sieve.conf.j2', dest: '/etc/dovecot/conf.d/90-sieve.conf' }
Hinrikus Wolf's avatar
Hinrikus Wolf committed
27
    - { src: 'templates/conf.d/auth-passwdfile.conf.ext.j2', dest: '/etc/dovecot/conf.d/auth-passwdfile.conf.ext' }
Hinrikus Wolf's avatar
Hinrikus Wolf committed
28
29
30
31
  notify:
    - restart dovecot
  tags:
    - dovecot
Hinrikus Wolf's avatar
Hinrikus Wolf committed
32
33
    - mail

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
- name: ensure there is a folder for global sieve scripts
  file: dest=/var/lib/dovecot/sieve.d state=directory owner=dovecot group=vmail mode=0770
  tags:
    - dovecot
    - mail
  when: content_filter is defined

- name: ensure the global spam filter and learning sieve script is present
  copy: src="files/{{ item }}" dest="/var/lib/dovecot/sieve.d/{{ item }}" mode=0550 owner=dovecot group=vmail
  with_items: 
    - filter_junk.sieve
    - report-spam.sieve
    - report-ham.sieve
  notify:
    - compile sieve script
  tags:
    - dovecot
    - mail
  when: content_filter is defined
Hinrikus Wolf's avatar
Hinrikus Wolf committed
53

Hinrikus Wolf's avatar
Hinrikus Wolf committed
54
55
56
57
58
59
60
61
62
- name: ensure dsync config is present
  template: src=templates/conf.d/99-dsync.conf.j2 dest=/etc/dovecot/conf.d/99-dsync.conf
  when: dsync == True
  notify:
    - restart dovecot
  tags:
    - dovecot
    - mail