From 7155c331829ea8909a45d4b8fe76d45b5e8341a4 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 20 Sep 2024 12:35:42 +0200 Subject: [PATCH] dnsmasq: fix template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It used to work. Then it didn’t. Now it works again. --- roles/dnsmasq/templates/10-ranges.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/dnsmasq/templates/10-ranges.conf.j2 b/roles/dnsmasq/templates/10-ranges.conf.j2 index 69692a3..aeae88f 100644 --- a/roles/dnsmasq/templates/10-ranges.conf.j2 +++ b/roles/dnsmasq/templates/10-ranges.conf.j2 @@ -8,7 +8,7 @@ dhcp-range = set:{{ prefix.vlan.name }},{{ range.start_address | ipaddr('address dhcp-option = tag:{{ prefix.vlan.name }},option:router,{{ prefix.custom_fields.gateway.address | ipaddr('address') }} {% endif -%} -{% for host in hostvars.values() | selectattr('primary_ip4') | selectattr('primary_ip4', 'ansible.utils.in_network', prefix.prefix) %} +{% for host in hostvars.values() | selectattr('primary_ip4', 'defined') | selectattr('primary_ip4', 'ansible.utils.in_network', prefix.prefix) %} {% for interface in host.interfaces | selectattr('mac_address') %} {% for address in interface.ip_addresses | selectattr('status.value', '==', 'dhcp') %} dhcp-host = {{ interface.mac_address | lower }},{{ address.address | ipaddr('address') }},{{ interface.device.name | lower }}