address {{ interface.address | ansible.utils.ipaddr('address') }} netmask {{ interface.address | ansible.utils.ipaddr('netmask') }} #### overlays {% for overlay in interface.overlays %} {% if 'name' in overlay %} ## {{ overlay.name }} {% endif %} up /bin/ip addr add dev $IFACE {{ overlay.address | ansible.utils.ipaddr('address') }}/32 up /bin/ip route add default via {{ overlay.gateway }} src {{ overlay.address | ansible.utils.ipaddr('address') }} table {{ 200 + loop.index0 }} up /bin/ip rule add pref {{ 40000 + loop.index0 }} from {{ overlay.address | ansible.utils.ipaddr('address') }} lookup {{ 200 + loop.index0 }} {% endfor %} ########## {% for overlay in interface.overlays | reverse %} {% if 'name' in overlay %} ## {{ overlay.name }} {% endif %} down /bin/ip rule del pref {{ 40000 + loop.revindex0 }} down /bin/ip route del default via {{ overlay.gateway }} src {{ overlay.address | ansible.utils.ipaddr('address') }} table {{ 200 + loop.revindex0 }} down /bin/ip addr del dev $IFACE {{ overlay.address | ansible.utils.ipaddr('address') }}/32 {% endfor %}