summaryrefslogtreecommitdiff
path: root/roles/vm/guest/network/templates/interfaces/simple.j2
blob: 26e8aec277f258f67455a2e4dfe9fda225c3c24a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
  address {{ interface.address | ansible.utils.ipaddr('address') }}
  netmask {{ interface.address | ansible.utils.ipaddr('netmask') }}
{% if 'gateway' in interface %}
  gateway {{ interface.gateway }}
{% endif %}
{% 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 %}
{% 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 %}