diff --git a/prepare_host.yaml b/prepare_host.yaml index c3d520a..ce41771 100644 --- a/prepare_host.yaml +++ b/prepare_host.yaml @@ -1,5 +1,8 @@ --- - hosts: vm_hosts + vars: + management_vlan: 9 + virtual_machine_vlan: 13 tasks: - name: install lxc related packages apt: diff --git a/templates/interfaces.j2 b/templates/interfaces.j2 index 7341e5d..e9bca0f 100644 --- a/templates/interfaces.j2 +++ b/templates/interfaces.j2 @@ -9,9 +9,13 @@ iface lo inet loopback # The primary network interface auto br0 -iface br0 inet static - address {{ ansible_default_ipv4.address }} - netmask 255.255.0.0 - gateway {{ hostvars[ext_gateway]['ansible_host'] }} - bridge_ports eth0 +iface br0 inet manual + bridge_ports eth0.{{ virtual_machine_vlan }} bridge_fd 1 + +auto eth0.{{ management_vlan }} +iface eth0.{{ management_vlan }} inet static + address {{ ansible_default_ipv4.address }} + gateway {{ hostvars[ext_gateway]['ansible_host'] }} + netmask 255.255.255.0 + vlan-raw-device eth0