From 387a4c8fd557fca94e30dc201e7b4b6613b7276a Mon Sep 17 00:00:00 2001 From: "pulsar89.5" Date: Sun, 30 Mar 2025 18:22:46 +0200 Subject: [PATCH] fix: Remove current instance --- handlers/main.yml | 2 +- tasks/records.yml | 1 + templates/auto.conf.j2 | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 58dc617..1584911 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -20,7 +20,7 @@ ansible.builtin.systemd: state: reloaded name: dnsmasq.service - when: dnsmasq_reload is defined + when: dnsmasq_reload is undefined loop: "{{ dnsmasq_hosts }}" delegate_to: "{{ item }}" run_once: true diff --git a/tasks/records.yml b/tasks/records.yml index 0597026..2bdee35 100644 --- a/tasks/records.yml +++ b/tasks/records.yml @@ -14,4 +14,5 @@ loop: "{{ dnsmasq_hosts }}" loop_control: loop_var: dnsserver + run_once: true notify: Reload dnsmasq.service on dns servers diff --git a/templates/auto.conf.j2 b/templates/auto.conf.j2 index e61d88a..c8a0b03 100644 --- a/templates/auto.conf.j2 +++ b/templates/auto.conf.j2 @@ -1,7 +1,7 @@ # {{ ansible_managed }} # ansible inventory -{%- set hosts = groups[dnsmasq_ansible_group] | sort | reject('equalto', inventory_hostname) %} +{%- set hosts = groups[dnsmasq_ansible_group] | reject('equalto', inventory_hostname) | sort %} {%- for host in hosts %} {%- set ipv4 = hostvars[host]['ansible_host'] %} {%- set ipv6_prefix = dnsmasq_ipv6_subnet | split('/') | first %}