rewire lxc-containers to 100% bridging

This commit is contained in:
Astro 2016-11-23 01:11:32 +01:00
parent 952c0f3b19
commit 07efe1620d
3 changed files with 18 additions and 7 deletions

View File

@ -18,3 +18,7 @@ hosts-inet:
pub-gw: 172.20.76.1
serv:
serv-gw: 172.20.73.1
priv1:
priv1-gw: 172.20.74.1
priv2:
priv2-gw: 172.20.75.1

View File

@ -5,7 +5,7 @@ containers:
type: veth
gw: anon1
pub:
type: phys
type: veth
serv-gw:
interfaces:
@ -21,7 +21,7 @@ containers:
type: veth
gw: upstream1
priv1:
type: phys
type: veth
priv2-gw:
interfaces:
@ -29,21 +29,21 @@ containers:
type: veth
gw: upstream2
priv2:
type: phys
type: veth
upstream1:
interfaces:
core:
type: veth
up1:
type: phys
type: veth
upstream2:
interfaces:
core:
type: veth
up2:
type: phys
type: veth
anon1:
interfaces:

View File

@ -39,14 +39,19 @@ bond0.{{ vlan }}:
- network: bond0
{% endfor %}
{%- for net in ['core', 'serv', 'mgmt'] %}
{%- set nets = ['mgmt', 'core', 'serv', 'pub'] %}
{%- for i in range(1, 9) %}
{%- set nets_ = nets.append('priv' ~ i) %}
{%- set nets_ = nets.append('up' ~ i) %}
{%- endfor %}
{%- for net in nets %}
{%- set vlan = pillar['vlans'][net] %}
br-{{ net }}:
network.managed:
- type: bridge
ports: bond0.{{ vlan }}
delay: 0
{%- set ip_addr = pillar['hosts-inet'][net].get('server1') %}
{%- set ip_addr = pillar['hosts-inet'].get(net) and pillar['hosts-inet'][net].get('server1') %}
{%- if ip_addr %}
{%- set prefix_len = pillar['subnets-inet'][net].split('/')[1] %}
proto: static
@ -57,6 +62,8 @@ br-{{ net }}:
{%- endif %}
{%- else %}
proto: manual
ipv6_autoconf: no
enable_ipv6: false
{%- endif %}
use:
- network: bond0.{{ vlan }}