Browse Source

Configure vlan on host

This commit includes the configuration of vlans on the host
for virtual machines. By configuring a bridge on the br0 interface
we can host the virtual machine vlan and by setting a vlan on the
logical device we can include it into the management vlan.
All variables are included from playbook
master
Edoardo Putti 8 years ago
parent
commit
07ec88eada
2 changed files with 12 additions and 5 deletions
  1. +3
    -0
      prepare_host.yaml
  2. +9
    -5
      templates/interfaces.j2

+ 3
- 0
prepare_host.yaml View File

@ -1,5 +1,8 @@
---
- hosts: vm_hosts
vars:
management_vlan: 9
virtual_machine_vlan: 13
tasks:
- name: install lxc related packages
apt:


+ 9
- 5
templates/interfaces.j2 View File

@ -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

Loading…
Cancel
Save