From 5283d2da951629c6213e6acc9dcba7e986dc451a Mon Sep 17 00:00:00 2001
From: lilly
Date: Wed, 6 May 2026 14:14:17 +0200
Subject: [PATCH] improve knot roles reloading behavior
With this change, the nameserver is not restarted on configuration
updates but only reloaded instead.
---
roles/knot/handlers/main.yaml | 10 ++--------
roles/knot/tasks/02-configure.yaml | 4 ++--
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/roles/knot/handlers/main.yaml b/roles/knot/handlers/main.yaml
index 11944a0..f89fedd 100644
--- a/roles/knot/handlers/main.yaml
+++ b/roles/knot/handlers/main.yaml
@@ -1,16 +1,10 @@
---
-- name: restart knot
+- name: reload knot
tags: [ auth-dns ]
become: true
ansible.builtin.systemd:
name: knot.service
- state: restarted
-
-- name: reload knot zones
- tags: [ auth-dns ]
- become: true
- changed_when: true
- ansible.builtin.command: "knotc zone-reload"
+ state: reloaded
- name: netplan apply
tags: [ auth-dns ]
diff --git a/roles/knot/tasks/02-configure.yaml b/roles/knot/tasks/02-configure.yaml
index 12b5732..2b0b0fa 100644
--- a/roles/knot/tasks/02-configure.yaml
+++ b/roles/knot/tasks/02-configure.yaml
@@ -13,7 +13,7 @@
- name: Deploy knot configuration file
tags: [ auth-dns ]
become: true
- notify: restart knot
+ notify: reload knot
ansible.builtin.template:
src: knot.conf.j2
dest: /etc/knot/knot.conf
@@ -24,7 +24,7 @@
- name: Deploy configured zones
tags: [ auth-dns ]
become: true
- notify: reload knot zones
+ notify: reload knot
loop: "{{ knot__zones }}"
loop_control:
label: "{{ item.domain }}"