blob: 865aa8c84c61b8dfaffd0dce822068ecbf24036a (
plain)
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
|
---
- name: var - set domain
set_fact:
domain: "{{ zonefile | basename | regex_replace('\\.zone\\.j2', '') }}"
- name: var - set domain_keyfile
set_fact:
domain_keyfile: /usr/local/etc/mail/dkim/{{ domain }}-{{ mail.dkim.selector }}.pem
- name: dkim - check domain key existence
stat:
path: "{{ domain_keyfile }}"
register: stat_result
- name: dkim - slurp domain key from the remote machine
slurp:
src: "{{ domain_keyfile }}"
# NOTE: get the contents with `{{ slurp_result['content'] | b64decode }}`
register: slurp_result
when: stat_result.stat.exists
- name: var - set domain_key
set_fact:
domain_key: "{{ slurp_result['content'] | b64decode }}"
when: stat_result.stat.exists
- name: NSD - generate zone files
template:
src: "{{ zonefile }}"
dest: "/usr/local/etc/nsd/zones/{{ domain }}.zone"
validate: "nsd-checkzone {{ domain }} %s"
notify: reload-nsd
|