From 1dca5d2259a1f5e19e79b12868fea7c77f635364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoha=C3=AF-Eliel=20BERREBY?= Date: Sat, 2 May 2020 16:43:44 +0200 Subject: [PATCH] unbound: use handlers Only restart unbound if the configuration was actually updated. --- roles/unbound/handlers/main.yml | 4 ++++ roles/unbound/tasks/main.yml | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 roles/unbound/handlers/main.yml diff --git a/roles/unbound/handlers/main.yml b/roles/unbound/handlers/main.yml new file mode 100644 index 0000000..c2efa8f --- /dev/null +++ b/roles/unbound/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart unbound + systemd: + state: restarted + name: unbound diff --git a/roles/unbound/tasks/main.yml b/roles/unbound/tasks/main.yml index 7374281..cabae99 100644 --- a/roles/unbound/tasks/main.yml +++ b/roles/unbound/tasks/main.yml @@ -24,20 +24,18 @@ src: unbound-control.conf.j2 dest: /etc/unbound/unbound.conf.d/unbound-control.conf mode: 0644 + notify: restart unbound - name: setup main unbound config file template: src: unbound.conf.j2 dest: /etc/unbound/unbound.conf mode: 0644 + notify: restart unbound - name: setup recursive DNS server config template: src: recursive.conf.j2 dest: /etc/unbound/unbound.conf.d/recursive.conf mode: 0644 - -- name: restart unbound after editing config - systemd: - state: restarted - name: unbound + notify: restart unbound