forked from PowerDNS/pdns_recursor-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.yml
84 lines (73 loc) · 2.49 KB
/
configure.yml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
- block:
- name: Ensure the PowerDNS Recursor drop-in unit overrides directory exists (systemd)
file:
name: "/etc/systemd/system/{{ pdns_rec_service_name }}.service.d"
state: directory
owner: root
group: root
- name: Override the PowerDNS Recursor unit (systemd)
template:
src: "override-service.systemd.conf.j2"
dest: "/etc/systemd/system/{{ pdns_rec_service_name }}.service.d/override.conf"
owner: root
group: root
register: _pdns_recursor_override_unit
- name: Reload systemd
command: systemctl daemon-reload
when: not pdns_rec_disable_handlers
and _pdns_recursor_override_unit.changed
when: ansible_service_mgr == "systemd"
and pdns_rec_service_overrides != {}
- name: Ensure that the PowerDNS Recursor configuration directory exists
file:
name: "{{ pdns_rec_config_dir }}"
state: directory
owner: root
group: root
mode: 0755
- name: Generate the PowerDNS Recursor configuration
template:
src: recursor.conf.j2
dest: "{{ pdns_rec_config_dir }}/{{ pdns_rec_config_file }}"
owner: "root"
group: "{{ pdns_rec_group }}"
mode: 0640
register: _pdns_recursor_configuration
- name: Ensure that the PowerDNS Recursor 'include-dir' directory exists
file:
name: "{{ pdns_rec_config['include-dir'] }}"
state: directory
owner: "root"
group: "root"
mode: 0755
when: "pdns_rec_config['include-dir'] is defined"
- name: Generate the PowerDNS Recursor Lua config-file
copy:
dest: "{{ pdns_rec_config_lua }}"
content: "{{ pdns_rec_config_lua_file_content }}"
owner: "root"
group: "{{ pdns_rec_group }}"
mode: 0640
register: _pdns_recursor_lua_file_configuraton
when: "pdns_rec_config_lua_file_content | length > 0"
- name: Generate PowerDNS Recursor Lua dns-script
copy:
dest: "{{ pdns_rec_config_dns_script }}"
content: "{{ pdns_rec_config_dns_script_file_content }}"
owner: "root"
group: "{{ pdns_rec_group }}"
mode: 0640
register: _pdns_recursor_dns_script_configuration
when: "pdns_rec_config_dns_script_file_content | length > 0"
- name: Restart PowerDNS Recursor
service:
name: "{{ pdns_rec_service_name }}"
state: restarted
sleep: 1
when: not pdns_rec_disable_handlers
and pdns_rec_service_state != 'stopped'
and (_pdns_recursor_override_unit.changed
or _pdns_recursor_configuration.changed
or _pdns_recursor_lua_file_configuraton.changed
or _pdns_recursor_dns_script_configuration.changed)