blob: 02ac34db0000487943aa4c6098a65bf38e3d9d08 (
plain) (
blame)
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
|
---
- name: create sub directory for keys
file:
path: "/etc/opendkim/keys/{{ opendkim_domain.key }}"
state: directory
mode: 0700
owner: opendkim
group: opendkim
- name: install precomputed keys
loop: "{{ opendkim_domain.value['keys'] | dict2items | selectattr('value.content', 'defined') }}"
loop_control:
label: "{{ item.key }}@{{ opendkim_domain.key }}"
copy:
dest: "/etc/opendkim/keys/{{ opendkim_domain.key }}/{{ item.key }}.private"
content: "{{ item.value.content }}"
mode: 0600
owner: opendkim
group: opendkim
- name: generate DKIM keys
loop: "{{ opendkim_domain.value['keys'] | dict2items | rejectattr('value.content', 'defined') }}"
loop_control:
label: "{{ item.key }}@{{ opendkim_domain.key }}"
command: "opendkim-genkey -b {{ item.value.keylength }} -s {{ item.key }} -d {{ opendkim_domain.key }} -D '/etc/opendkim/keys/{{ opendkim_domain.key }}'"
args:
creates: "/etc/opendkim/keys/{{ opendkim_domain.key }}/{{ item.key }}.private"
- name: fix permission for generated DKIM keys
loop: "{{ opendkim_domain.value['keys'] | dict2items | rejectattr('value.content', 'defined') }}"
loop_control:
label: "{{ item.key }}@{{ opendkim_domain.key }}"
file:
path: "/etc/opendkim/keys/{{ opendkim_domain.key }}/{{ item.key }}.private"
mode: 0600
owner: opendkim
group: opendkim
|