
With bionic we need to switch to systemd-networkd rather than the legacy /e/n/i. This makes the mnaio host networkd only, since we will only be supprting xenial and beyond on the host we can do this. The VM's will detect the networking configuration daemon and act appropriately. This also brings up the IPs on the bridges without having any interfaces attached. Change-Id: I72283a2786316181f7ab7d8aad21ad456e9c9503
37 lines
1.1 KiB
Django/Jinja
37 lines
1.1 KiB
Django/Jinja
# Physical interface, could be bond. This only needs to be set once
|
|
{% set server_networks = hostvars[item]['server_networks'] %}
|
|
|
|
{% for key, value in server_networks.items()|sort(attribute='1.iface') %}
|
|
{% if value.iface is defined %}
|
|
auto {{ value.iface }}
|
|
iface {{ value.iface }} inet manual
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% for key, value in server_networks.items()|sort(attribute='1.iface') %}
|
|
auto br-{{ key }}
|
|
iface br-{{ key }} inet {{ value.inet_type }}
|
|
bridge_stp off
|
|
bridge_waitport 10
|
|
bridge_fd 0
|
|
offload-sg off
|
|
{% if value.iface is defined and key == "flat" %}
|
|
pre-up ip link add br-veth-{{ key }} type veth peer name v{{ value.iface }} || true
|
|
# Set both ends UP
|
|
pre-up ip link set br-veth-{{ key }} up
|
|
pre-up ip link set v{{ value.iface }} up
|
|
# Delete veth pair on DOWN
|
|
post-down ip link del br-vlan-veth || true
|
|
bridge_ports {{ value.iface }} br-veth-{{ key }}
|
|
{% elif value.iface is defined %}
|
|
bridge_ports {{ value.iface | default('none') }}
|
|
{% else %}
|
|
bridge_ports none
|
|
{% endif %}
|
|
{% if value.address is defined %}
|
|
address {{ value.address }}
|
|
{% endif %}
|
|
|
|
{% endfor %}
|