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

@ -33,14 +33,14 @@ iface {{ iface.name }}
{% for address in iface.ip_addresses %}
address {{ address.address }}
{% if address.family.value == 4 %}
{% set subnet = address.address | ipaddr('subnet') %}
{% set subnet = address.address | ansible.utils.ipaddr('subnet') %}
{% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %}
{% set gateway = prefix.custom_fields.gateway.address %}
{% if gateway is defined and gateway != address.address %}
{% if iface.vrf %}
up ip route add default via {{ gateway | ipaddr('address') }} {% if iface.vrf.name %}vrf {{ iface.vrf.name }}{% endif +%}
up ip route add default via {{ gateway | ansible.utils.ipaddr('address') }} {% if iface.vrf.name %}vrf {{ iface.vrf.name }}{% endif +%}
{% else %}
gateway {{ gateway | ipaddr('address') }}
gateway {{ gateway | ansible.utils.ipaddr('address') }}
{% endif %}
{% endif %}
{% endif %}