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 pub-gw: 172.20.76.1
serv: serv:
serv-gw: 172.20.73.1 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 type: veth
gw: anon1 gw: anon1
pub: pub:
type: phys type: veth
serv-gw: serv-gw:
interfaces: interfaces:
@ -21,7 +21,7 @@ containers:
type: veth type: veth
gw: upstream1 gw: upstream1
priv1: priv1:
type: phys type: veth
priv2-gw: priv2-gw:
interfaces: interfaces:
@ -29,21 +29,21 @@ containers:
type: veth type: veth
gw: upstream2 gw: upstream2
priv2: priv2:
type: phys type: veth
upstream1: upstream1:
interfaces: interfaces:
core: core:
type: veth type: veth
up1: up1:
type: phys type: veth
upstream2: upstream2:
interfaces: interfaces:
core: core:
type: veth type: veth
up2: up2:
type: phys type: veth
anon1: anon1:
interfaces: interfaces:

View File

@ -39,14 +39,19 @@ bond0.{{ vlan }}:
- network: bond0 - network: bond0
{% endfor %} {% 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] %} {%- set vlan = pillar['vlans'][net] %}
br-{{ net }}: br-{{ net }}:
network.managed: network.managed:
- type: bridge - type: bridge
ports: bond0.{{ vlan }} ports: bond0.{{ vlan }}
delay: 0 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 %} {%- if ip_addr %}
{%- set prefix_len = pillar['subnets-inet'][net].split('/')[1] %} {%- set prefix_len = pillar['subnets-inet'][net].split('/')[1] %}
proto: static proto: static
@ -57,6 +62,8 @@ br-{{ net }}:
{%- endif %} {%- endif %}
{%- else %} {%- else %}
proto: manual proto: manual
ipv6_autoconf: no
enable_ipv6: false
{%- endif %} {%- endif %}
use: use:
- network: bond0.{{ vlan }} - network: bond0.{{ vlan }}