summaryrefslogtreecommitdiffstats
path: root/roles/amavis/tasks/main.yml
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2014-07-03 04:26:26 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 02:52:20 +0200
commit1c357b55931a0d4fbd15d51d61ec4e81d4f38aa5 (patch)
treed5f37b52487f75c3ffe40a39c94ea570c32816a5 /roles/amavis/tasks/main.yml
parentdfe8b222dc5067e1019d7ab5744df55b2c314ce8 (diff)
Install amavisd-new on the outgoing SMTP proxy.
For DKIM signing and virus checking.
Diffstat (limited to 'roles/amavis/tasks/main.yml')
-rw-r--r--roles/amavis/tasks/main.yml62
1 files changed, 62 insertions, 0 deletions
diff --git a/roles/amavis/tasks/main.yml b/roles/amavis/tasks/main.yml
new file mode 100644
index 0000000..354ade8
--- /dev/null
+++ b/roles/amavis/tasks/main.yml
@@ -0,0 +1,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/outgoing.fripost.org.key --dns=outgoing -t rsa -b 2048
+ register: dkim
+ changed_when: dkim.rc == 0
+ failed_when: dkim.rc > 1
+ notify:
+ - Restart Amavis
+ - Publish the public key in 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