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 shell: /lib/opendkim/opendkim.service.generate && systemctl daemon-reload
13 when: opendkim_env.changed
16 - name: generate opendkim keys
17 shell: mkdir /etc/opendkim/{{ item }}/ && opendkim-genkey --bits=2048 -s mail -d {{ item }} -D /etc/opendkim/{{ item }}/
19 creates: /etc/opendkim/{{ item }}/mail.private
21 loop: "{{ postfix.opendkim.private_keys }}"
22 - name: generate opendkim tables
24 dest: /etc/opendkim/{{ item }}
25 src: templates/{{ item }}
31 - name: install opendkim config
33 dest: /etc/opendkim.conf
34 src: templates/opendkim.conf