diff --git a/handlers/main.yml b/handlers/main.yml index 3b1d2a4..58dc617 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -9,15 +9,18 @@ become: true - name: Reload dnsmasq.service - become: true ansible.builtin.systemd: - state: reloaded name: dnsmasq.service + state: reloaded + become: true + register: dnsmasq_reload - name: Reload dnsmasq.service on dns servers become: true ansible.builtin.systemd: state: reloaded name: dnsmasq.service + when: dnsmasq_reload is defined loop: "{{ dnsmasq_hosts }}" delegate_to: "{{ item }}" + run_once: true diff --git a/templates/auto.conf.j2 b/templates/auto.conf.j2 index 2f1ca91..e61d88a 100644 --- a/templates/auto.conf.j2 +++ b/templates/auto.conf.j2 @@ -1,7 +1,8 @@ # {{ ansible_managed }} # ansible inventory -{%- for host in (groups[dnsmasq_ansible_group] | sort) %} +{%- set hosts = groups[dnsmasq_ansible_group] | sort | reject('equalto', inventory_hostname) %} +{%- for host in hosts %} {%- set ipv4 = hostvars[host]['ansible_host'] %} {%- set ipv6_prefix = dnsmasq_ipv6_subnet | split('/') | first %} {%- set ipv6_suffix = hostvars[host]['ansible_host'] | split('.') | last %} diff --git a/templates/specific.conf.j2 b/templates/specific.conf.j2 deleted file mode 100644 index d1022d3..0000000 --- a/templates/specific.conf.j2 +++ /dev/null @@ -1,8 +0,0 @@ -# {{ ansible_managed }} -{% for specific in dnsmasq_specifics %} - -# {{ specific.hostname }} -{% for ip in specific.ips %} -{{ ip }} {{ specific.hostname }} -{% endfor %} -{% endfor %}