summaryrefslogtreecommitdiffstats
path: root/roles/amavis/tasks/main.yml
blob: 6965c07a152e395b8a3c84a72feaf2d4b5dc6b29 (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
- name: Install amavis and its decoders
  apt: pkg={{ item }}
  with_items:
    - amavisd-new
    # Mail::DKIM
    - libmail-dkim-perl
    - gzip
    - bzip2
    - xz-utils
    - lzop
    - rpm2cpio
    - pax
    - binutils
    - p7zip-full
    - unrar-free
    - arj
    - nomarch
    - zoo
    - ripole
    - cabextract
    - unar
    - tnef
  notify:
    - Restart Amavis

- name: Add 'clamav' to the group 'amavis'
  user: name=clamav groups=amavis append=yes
  register: r1
  notify:
    - Restart ClamAV
    - Restart Amavis

- name: Create directory /var/lib/dkim
  file: path=/var/lib/dkim
        state=directory
        owner=root group=root
        mode=0755

- name: Generate a private key for DKIM signing
  command: genkeypair.sh dkim --privkey=/var/lib/dkim/20140703.fripost.org.key -t rsa -b 1024
  register: dkim
  changed_when: dkim.rc == 0
  failed_when: dkim.rc > 1
  notify:
    - Restart Amavis
    - Publish the public key to the DNS zone
  tags:
    - genkey

- name: Configure Amavis
  template: src=etc/amavis/conf.d/50-user.j2
            dest=/etc/amavis/conf.d/50-user
            owner=root group=root
            mode=0644
  register: r3
  notify:
    - Restart Amavis

- meta: flush_handlers

- name: Start Amavis
  service: name=amavis state=started