Skip to content

Commit a65fcb7

Browse files
committed
ansible/unbound: Use handlers to reload configuration
1 parent 0329e79 commit a65fcb7

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- name: reload resolvconf
2+
when: not in_docker
3+
systemd:
4+
name: resolvconf
5+
state: reloaded
6+
7+
- name: reload unbound
8+
when: not in_docker
9+
systemd:
10+
name: unbound
11+
state: reloaded

ansible/roles/unbound/tasks/main.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- resolvconf
88

99
- name: Setup localhost as the default nameserver
10+
notify: reload resolvconf
1011
lineinfile:
1112
path: /etc/resolvconf/resolv.conf.d/base
1213
create: true
@@ -19,6 +20,7 @@
1920
line: "domain hashbang.sh"
2021

2122
- name: Configure unbound
23+
notify: reload unbound
2224
copy:
2325
dest: /etc/unbound/unbound.conf.d/{{ item.key }}.conf
2426
validate: unbound-checkconf %s
@@ -67,13 +69,14 @@
6769
# Implementation of draft-dns-0x20, makes DNS poisoning harder
6870
use-caps-for-id: yes
6971
70-
- name: Enable & reload services
72+
73+
- name: Enable services
7174
when: not in_docker
7275
systemd:
7376
name: "{{ item }}"
7477
enabled: yes
7578
masked: no
76-
state: reloaded # TODO: This should be a handler instead
79+
state: started
7780

7881
with_items:
7982
- unbound

0 commit comments

Comments
 (0)