ipaddr was moved to ansible.utils

This commit is contained in:
Miha Frangež 2026-01-09 11:32:58 +01:00
parent 8276c6e8b4
commit 32ddf5e58e
9 changed files with 16 additions and 16 deletions

View file

@ -1,11 +1,11 @@
{% for prefix in prefixes | selectattr('custom_fields.dhcp_server') | sort(attribute='vlan.name') %}
{% if prefix.custom_fields.dhcp_server.address | ipaddr('address') == primary_ip4 %}
{% if prefix.custom_fields.dhcp_server.address | ansible.utils.ipaddr('address') == primary_ip4 %}
# {{ prefix.vlan.name }}
{% for range in prefix.custom_fields.dhcp_ranges | default([], true) %}
dhcp-range = set:{{ prefix.vlan.name }},{{ range.start_address | ipaddr('address') }},{{ range.end_address | ipaddr('address') }},{{ prefix.prefix | ipaddr('netmask') }}
dhcp-range = set:{{ prefix.vlan.name }},{{ range.start_address | ansible.utils.ipaddr('address') }},{{ range.end_address | ansible.utils.ipaddr('address') }},{{ prefix.prefix | ansible.utils.ipaddr('netmask') }}
{% endfor %}
{% if prefix.custom_fields.gateway %}
dhcp-option = tag:{{ prefix.vlan.name }},option:router,{{ prefix.custom_fields.gateway.address | ipaddr('address') }}
dhcp-option = tag:{{ prefix.vlan.name }},option:router,{{ prefix.custom_fields.gateway.address | ansible.utils.ipaddr('address') }}
{% endif -%}
{% for host in hostvars.values() | selectattr('interfaces', 'defined') %}
@ -24,5 +24,5 @@ dhcp-host = {{ interface.mac_address | lower }},{{ address }},{{ interface.devic
# custom reservations
{% for reservation in reservations | default([]) %}
dhcp-host = {{ reservation.mac | lower }},{{ reservation.ip | ipaddr('address') }},{{ reservation.host | lower }}
dhcp-host = {{ reservation.mac | lower }},{{ reservation.ip | ansible.utils.ipaddr('address') }},{{ reservation.host | lower }}
{% endfor %}