blob: b678150af9d652a4e5f344dcdfcc7f615537a2ef (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
address {{ interface.address | ansible.utils.ipaddr('address') }}
netmask {{ interface.address | ansible.utils.ipaddr('netmask') }}
up /bin/ip addr add dev $IFACE {{ interface.overlay }}/32
{% for route in interface.static_routes | default([]) %}
up /bin/ip route add {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %}{{ '' }}
{% endfor %}
{% if 'gateway' in interface %}
up /bin/ip route add default via {{ interface.gateway }} src {{ interface.overlay }}
down /bin/ip route del default via {{ interface.gateway }} src {{ interface.overlay }}
{% endif %}
{% for route in interface.static_routes | default([]) | reverse %}
down /bin/ip route del {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %}{{ '' }}
{% endfor %}
down /bin/ip addr del dev $IFACE {{ interface.overlay }}/32
|