1 - name: install opendkim
2 apt: name=opendkim,opendkim-tools state=latest
3 - name: enable opendkim
4 service: name=opendkim enabled=yes
6 - name: install opendkim env
9 dest: /etc/default/opendkim
10 src: templates/opendkim.env
11 - name: regenerate opendkim service
12 when: opendkim_env.changed
13 shell: /lib/opendkim/opendkim.service.generate && systemctl daemon-reload && systemd-tmpfiles /etc/tmpfiles.d/opendkim.conf --create
16 - name: create opendkim dir
17 file: name=/etc/opendkim state=directory owner=opendkim
18 - name: generate opendkim keys
19 shell: mkdir /etc/opendkim/{{ item }}/ && opendkim-genkey --bits=2048 -s mail -d {{ item }} -D /etc/opendkim/{{ item }}/
22 creates: /etc/opendkim/{{ item }}/mail.private
24 loop: "{{ postfix.opendkim.private_keys }}"
25 - name: generate opendkim tables
27 dest: /etc/opendkim/{{ item }}
28 src: templates/{{ item }}
34 - name: install opendkim config
36 dest: /etc/opendkim.conf
37 src: templates/opendkim.conf