blob: 580abf88776bff66d2be4af79afdc7e21f66c810 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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 %}
|