ansible/roles/ifupdown2/templates/interfaces.j2

64 lines
2 KiB
Django/Jinja

{{ ansible_managed | comment }}
{% for name, iface in ifupdown2__interfaces.items() %}
auto {{ name }}
iface {{ name }}
{% for address in iface.addresses | default([]) %}
address {{ address | ipaddr }}
{% endfor %}
{% for gateway in iface.gateways | default([]) %}
gateway {{ gateway | ipaddr }}
{% endfor %}
{% if iface.bridge_ports is defined %}
bridge-ports {{ iface.bridge_ports | join(" ") }}
{% endif %}
{% if iface.bridge_vlan_aware is defined %}
bridge-vlan-aware {{ iface.bridge_vlan_aware
| ternary("yes", "no") }}
{% endif %}
{% if iface.bridge_vids is defined %}
bridge-vids {{ iface.bridge_vids | join(",") }}
{% endif %}
{% if iface.vlan_id is defined %}
vlan-id {{ iface.vlan_id | int }}
{% endif %}
{% if iface.vlan_raw_device is defined %}
vlan-raw-device {{ iface.vlan_raw_device }}
{% endif %}
{% if iface.bridge_disable_pvid | default(false) %}
bridge-pvid 0
post-up bridge vlan del dev {{ name }} vid 1 self
{% endif %}
{% if iface.forward | default(false) %}
ip-forward yes
ip6-forward yes
{% endif %}
{% if iface.ipv6_addrgen is defined %}
ipv6-addrgen {{ iface.ipv6_addrgen
| ternary("yes", "no") }}
{% endif %}
{% if iface.mtu is defined %}
mtu {{ iface.mtu | int }}
{% endif %}
{% if iface.vxlan_learning is defined %}
vxlan-learning {{ iface.vxlan_learning
| ternary("yes", "no") }}
{% endif %}
{% if iface.vxlan_physdev is defined %}
vxlan-physdev {{ iface.vxlan_physdev }}
{% endif %}
{% if iface.vxlan_port is defined %}
vxlan-port {{ iface.vxlan_port | int }}
{% endif %}
{% if iface.vxlan_mcastgrp is defined %}
vxlan-mcastgrp {{ iface.vxlan_mcastgrp }}
{% endif %}
{% if iface.bridge_vlan_vni_map is defined %}
bridge-vlan-vni-map {{ iface.bridge_vlan_vni_map }}
{% endif %}
{% if iface.bridge_learning is defined %}
bridge-learning {{ iface.bridge_learning
| ternary("yes", "no") }}
{% endif %}
{% endfor %}