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 && chmod +r /etc/systemd/system/opendkim.service.d/ -R && 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
23 loop: "{{ postfix.opendkim.private_keys }}"
24 - name: generate opendkim tables
26 dest: /etc/opendkim/{{ item }}
27 src: templates/{{ item }}
33 - name: install opendkim config
35 dest: /etc/opendkim.conf
36 src: templates/opendkim.conf