summaryrefslogtreecommitdiff
path: root/roles/vm/guest/network/templates/interfaces/multihomed-overlay6.j2
blob: 5eb675813307f3e5340936791920244fdfc7c305 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  address {{ interface.address6 }}
  #### overlays
{% for overlay in interface.overlays %}
{%   if 'address6' in overlay %}
{%     if 'name' in overlay %}
  ## {{ overlay.name }}
{%     endif %}
  up /bin/ip -6 addr add dev $IFACE {{ overlay.address6 | ansible.utils.ipaddr('address') }}/128 nodad preferred_lft 0
  up /bin/ip -6 route add default via {{ overlay.gateway6 }} src {{ overlay.address6 | ansible.utils.ipaddr('address') }} table {{ 200 + loop.index0 }}
  up /bin/ip -6 rule add pref {{ 40000 + loop.index0 }} from {{ overlay.address6 | ansible.utils.ipaddr('address') }} lookup {{ 200 + loop.index0 }}
{%   endif %}
{% endfor %}
  ##########
{% for overlay in interface.overlays | reverse %}
{%   if 'address6' in overlay %}
{%     if 'name' in overlay %}
  ## {{ overlay.name }}
{%     endif %}
  down /bin/ip rule del pref {{ 40000 + loop.revindex0 }}
  down /bin/ip route del default via {{ overlay.gateway6 }} src {{ overlay.address6 | ansible.utils.ipaddr('address') }} table {{ 200 + loop.revindex0 }}
  down /bin/ip addr del dev $IFACE {{ overlay.address6 | ansible.utils.ipaddr('address') }}/128
{%   endif %}
{% endfor %}