Fix container bridge networking on SUSE

The GATEWAY attribute does not exist on SUSE so we need to add the
default gateway to an ifroute file. Moreover, we drop the DEVICE
attribute which also doesn't exist on SUSE ifcfg files and we add
STARTMODE='auto' to instruct wicked to automatically configure the
interface on every boot. Finally we switch STP to 'off' since there
is only a single bridge accessible from containers.

Change-Id: I9c09e2882614f89cb944a623e7b97298d4bec541
This commit is contained in:
Markos Chandras 2017-05-08 10:45:46 +01:00
parent 24dcf76a9f
commit 583337b69b
3 changed files with 21 additions and 5 deletions

View File

@ -29,6 +29,24 @@
- lxc-bridge
- lxc-interfaces
- name: Drop lxc net bridge routes (SUSE)
template:
src: "lxc-net-suse-routes.cfg.j2"
dest: "/etc/sysconfig/network/ifroute-{{ lxc_net_bridge }}"
owner: "root"
group: "root"
mode: "0644"
when:
- lxc_net_gateway is not none
- ansible_pkg_mgr == "zypper"
notify:
- Bring bridge up
tags:
- lxc-files
- lxc-net
- lxc-bridge
- lxc-interfaces
# All Debian installations of LXC use the lxc-net service. This service breaks our network
# model and needs to be disabled
- name: Disable and stop lxc-net

View File

@ -1,17 +1,14 @@
# {{ ansible_managed }}
DEVICE={{ lxc_net_bridge }}
BRIDGE='yes'
IPADDR={{ lxc_net_address }}
NETMASK={{ lxc_net_netmask }}
{% if lxc_net_gateway is not none %}
GATEWAY={{ lxc_net_gateway }}
{% endif %}
{% if lxc_net_mtu is defined %}
MTU={{ lxc_net_mtu }}
{% endif %}
BOOTPROTO=static
BRIDGE_STP='on'
STARTMODE=auto
BRIDGE_STP='off'
# POST_UP script
POST_UP_SCRIPT="compat:suse:ifup-post-{{ lxc_net_bridge }}"
# POST_DOWN script

View File

@ -0,0 +1 @@
default {{ lxc_net_gateway }}