123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293#
# !!! This file is managed by Ansible !!!
#
{% for interface in network.interfaces %}
auto {{ interface.name }}
{% if interface.loopback is defined %}
iface {{ interface.name }} inet loopback
{% elif interface.manual is defined %}
iface {{ interface.name }} inet manual
{% else %}
{% if interface.ipv4.dhcp is defined %}
iface {{ interface.name }} inet dhcp
{% else %}
iface {{ interface.name }} inet static
{% if system.hostname is defined %}
hostname {{ system.hostname }}
{% endif %}
{% if interface.bridge_ports is defined %}
bridge-ports {{interface.bridge_ports}}
{% endif %}
{% if interface.bridge_stp is defined %}
{% if interface.bridge_stp is true %}
bridge-stp 1
{% else %}
bridge-stp 0
{% endif %}
{% endif %}
{% if interface.ipv4.address is defined %}
address {{ interface.ipv4.address }}
{% endif %}
{% if interface.ipv4.netmask is defined %}
netmask {{ interface.ipv4.netmask }}
{% endif %}
{% if interface.ipv4.gateway is defined %}
gateway {{ interface.ipv4.gateway }}
{% endif %}
{% if interface.pre_up is defined %}
{% for command in inteface.pre_up %}
pre-up {{ command }}
{% endfor %}
{% endif %}
{% if interface.post_up is defined %}
{% for command in inteface.post_up %}
post-up {{ command }}
{% endfor %}
{% endif %}
{% if interface.post_down is defined %}
{% for command in inteface.post_down %}
post-down {{ command }}
{% endfor %}
{% endif %}
{% endif %}
{% if interface.ipv6 is defined %}
{% if interface.ipv6.stateless is defined %}
iface {{ interface.name }} inet6 manual
pre-up echo 1 > /proc/sys/net/ipv6/conf/eth0/accept_ra
{% else %}
iface {{ interface.name }} inet6 static
{% if system.hostname is defined %}
hostname {{ system.hostname }}
{% endif %}
{% if interface.ipv6.address is defined %}
address {{ interface.ipv6.address }}
{% endif %}
{% if interface.ipv6.netmask is defined %}
netmask {{ interface.ipv6.netmask }}
{% endif %}
{% if interface.ipv6.gateway is defined %}
gateway {{ interface.ipv6.gateway }}
{% endif %}
{% if interface.pre_up is defined %}
{% for command in inteface.pre_up %}
pre-up {{ command }}
{% endfor %}
{% endif %}
{% if interface.post_up is defined %}
{% for command in inteface.post_up %}
post-up {{ command }}
{% endfor %}
{% endif %}
{% if interface.post_down is defined %}
{% for command in inteface.post_down %}
post-down {{ command }}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}