107 lines
3.5 KiB
Django/Jinja
107 lines
3.5 KiB
Django/Jinja
auto lo
|
|
iface lo inet loopback
|
|
{% if host_loopback_IP is defined %}
|
|
auto lo:1
|
|
iface lo:1 inet static
|
|
address {{host_loopback_IP}}/32
|
|
{% endif %}
|
|
|
|
{% if OOBNET_NIC is defined %}
|
|
auto {{OOBNET_NIC}}
|
|
allow-hotplug {{OOBNET_NIC}}
|
|
iface {{OOBNET_NIC}} inet {% if OOBNET_DHCP is defined and OOBNET_DHCP|lower == "true" %}dhcp{% else %}static
|
|
address {{OOBNET_IP}}/{{OOBNET_Netmask}}
|
|
{% if OOBNET_GW is defined %}gateway {{OOBNET_GW}}{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if autobgp_interfaces is defined %}
|
|
{% for item in autobgp_interfaces %}
|
|
|
|
auto {{ item['name'] }}
|
|
allow-hotplug {{ item['name'] }}
|
|
iface {{ item['name'] }} inet {% if item['dhcp'] is defined and item['dhcp']|lower == "true" %}dhcp{% else %}static
|
|
address {{host_loopback_IP}}/32
|
|
{% endif %}
|
|
{% if item['mtu'] is defined %}
|
|
mtu {{ item['mtu'] }}
|
|
{% endif %}
|
|
{% if item['force10G'] is defined and item['force10G']|lower == "true" %}
|
|
# Force speed to 10G
|
|
post-up sudo ethtool -s {{ item['name'] }} autoneg off
|
|
post-up sudo ethtool -s {{ item['name'] }} speed 10000
|
|
{% endif %}
|
|
{% if item['force40G'] is defined and item['force40G']|lower == "true" %}
|
|
# Force speed to 40G
|
|
pre-up sudo ethtool -s {{ item['name'] }} autoneg off
|
|
pre-up sudo ethtool -s {{ item['name'] }} speed 40000
|
|
{% endif %}
|
|
{% if item['routes'] is defined %}
|
|
{% for route in item['routes'] %}
|
|
up ip route add {{ route['network'] }} via {{ route['gateway'] }} || true
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if addressed_interfaces is defined and addressed_interfaces != [] %}
|
|
{% for item in addressed_interfaces %}
|
|
|
|
auto {{ item['name'] }}
|
|
allow-hotplug {{ item['name'] }}
|
|
iface {{ item['name'] }} inet {% if item['dhcp'] is defined and item['dhcp']|lower == "true" %}dhcp{% else %}static
|
|
address {{item['ip_address']}}/{{item['ip_netmask']}}
|
|
{% endif %}
|
|
{% if item['mtu'] is defined %}
|
|
mtu {{ item['mtu'] }}
|
|
{% endif %}
|
|
{% if item['routes'] is defined %}
|
|
{% for route in item['routes'] %}
|
|
up ip route add {{ route['network'] }} via {{ route['gateway'] }} || true
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if bond_interfaces is defined and bond_interfaces != [] %}
|
|
{% for item in bond_interfaces %}
|
|
{% for slave in item['slaves'] %}
|
|
auto {{slave['name']}}
|
|
iface {{slave['name']}} inet manual
|
|
bond-master {{ item['name'] }}
|
|
{% endfor %}
|
|
|
|
auto {{ item['name'] }}
|
|
iface {{ item['name'] }} inet {% if item['dhcp'] is defined and item['dhcp']|lower == "true" %}dhcp{% else %}{% if item['ip_address'] is defined %}static
|
|
address {{item['ip_address']}}/{{item['ip_netmask']}}
|
|
{% else %}manual{% endif %}{% endif %}
|
|
{% if item['routes'] is defined %}
|
|
{% for route in item['routes'] %}
|
|
up ip route add {{ route['network'] }} via {{ route['gateway'] }} || true
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if vlan_interfaces is defined and vlan_interfaces != [] %}
|
|
{% for item in vlan_interfaces %}
|
|
auto {{ item['name'] }}
|
|
iface {{ item['name'] }} inet {% if item['dhcp'] is defined and item['dhcp']|lower == "true" %}dhcp{% else %}{% if item['ip_address'] is defined %}static
|
|
address {{item['ip_address']}}/{{item['ip_netmask']}}
|
|
{% else %}manual{% endif %}{% endif %}
|
|
{% if item['routes'] is defined %}
|
|
{% for route in item['routes'] %}
|
|
up ip route add {{ route['network'] }} via {{ route['gateway'] }} || true
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if unused_interfaces is defined and unused_interfaces != [] %}
|
|
{% for item in unused_interfaces %}
|
|
allow-hotplug {{ item['name'] }}
|
|
iface {{ item['name'] }} inet manual
|
|
{% endfor %}
|
|
{% endif %}
|