Deploying OpenStack with MAAS and Ansible

I’m gonna describe how i setup openstack test environment using MAAS and Ansible on two servers using a dumb switch.

I’m inspired and taken most of implementation from this post. Hardware i used is as follows.

  • Lenovo Thinkpad (2 cores, 8GB RAM, 500GB HDD, 2 NICS )
  • XEON Workstation(4cores, 4GB RAM, 500GB HDD, 2 NICS)
  • one dumb switch

The environment more or less looks like this.

With this environment, to install OpenStack using the Ansible Playbooks, I essentially do the following steps:

  1. PXE Boot Ubuntu 16.04 across my VM’s on both Thinkpad and XEON server using MAAS.
  2. Configure the networking
  3. Configure OSAD deployment by grabbing the pre-built configuration files
  4. Run the OSAD Playbooks

Let’s prepare MAAS. I used my Thinkpad as MAAS server which has 2 NICs in which one is connected to my home router and other to dumb switch through a linux bridge ‘br0’.I enabled 8021q module on both thinkpad and  xeon server.

Below is my /etc/network/interfaces file of my thinkpad:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto wlp3s0
iface wlp3s0 inet dhcp
 wpa-ssid 
 wpa-psk 

auto enp0s25
iface enp0s25 inet manual

auto enp0s25.10
iface enp0s25.10 inet manual
vlan-raw-device enp0s25

auto enp0s25.20
iface enp0s25.20 inet manual
vlan-raw-device enp0s25

auto enp0s25.30
iface enp0s25.30 inet manual
vlan-raw-device enp0s25

auto enp0s25.99
iface enp0s25.99 inet manual
vlan-raw-device enp0s25

## MAAS provisioning bridge.
auto br0
iface br0 inet static
address 10.14.0.1
netmask 255.255.255.0
dns-nameservers 10.14.0.1
dns-search maas
post-up iptables -t nat -A POSTROUTING -o wlp3s0 -j SNAT --to-source 192.168.99.58
post-down iptables -t nat -D POSTROUTING -o wlp3s0 -j SNAT --to-source 192.168.99.58
bridge_ports enp0s25
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

##Container/Host Management bridge.
auto br-mgmt
iface br-mgmt inet static
address 172.29.236.10
netmask 255.255.242.0
dns-nameservers 8.8.8.8 8.8.4.4
bridge_ports enp0s25.10
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

##VLAN bridge.
auto br-vxlan
iface br-vxlan inet manual
bridge_ports enp0s25.20
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

##VXLAN bridge.
auto br-vxlan
iface br-vxlan inet manual
bridge_ports enp0s25.30
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

##STORAGE bridge.
auto br-vlan99
iface br-vlan99 inet manual
bridge_ports enp0s25.99
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

source /etc/network/interfaces.d/*.cfg

Below is my /etc/network/interfaces file of my xeon server:

This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto enp3
iface enp3 inet dhcp

auto enp4
iface enp4 inet manual

auto enp4.10
iface enp4.10 inet manual
vlan-raw-device enp4

auto enp4.20
iface enp4.20 inet manual
vlan-raw-device enp4

auto enp4.30
iface enp4.30 inet manual
vlan-raw-device enp4

auto enp4.99
iface enp4.99 inet manual
vlan-raw-device enp4

## MAAS provisioning bridge.

auto br0
iface br0 inet static
address 10.14.0.2
netmask 255.255.255.0
dns-nameservers 10.14.0.1
dns-search maas
post-up iptables -t nat -A POSTROUTING -o enp0s25 -j SNAT --to-source 192.168.10.175
post-down iptables -t nat -D POSTROUTING -o enp0s25 -j SNAT --to-source 192.168.10.175
bridge_ports enp4
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

##Container/Host Management bridge.

auto br-mgmt
iface br-mgmt inet static
address 172.29.236.11
netmask 255.255.242.0
dns-nameservers 8.8.8.8  8.8.4.4
bridge_ports enp4.10
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

##VLAN bridge.

auto br-vxlan
iface br-vxlan inet manual
bridge_ports enp4.20
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

##VXLAN bridge.

auto br-vxlan
iface br-vxlan inet manual
bridge_ports enp4.30
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

## STORAGE bridge

auto br-vlan99
iface br-vlan99 inet manual
bridge_ports enp4.99
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

source /etc/network/interfaces.d/*.cfg

Then I installed MAAS on my thinkpad.

$ sudo apt install maas
$ sudo dpkg-reconfigure maas-region-controller
10.14.0.1
$ sudo dpkg-reconfigure maas-rack-controller
10.14.0.1
$ sudo maas-region createsuperuser ## I created an user named root here.

Go to MAAS dashboard at http://10.14.0.1/MAAS/ then provide dhcp on 10.14.0.1/24 network. Now i’m ready to pxe boot VM’s on 10.14.0.0/24 network. I will now create VM’s using KVM on both thinkpad , xeon servers and provision them using MAAS.

First install all required programs on the both of them to run VM’s.

$ sudo apt install libvirt-bin qemu-kvm cpu-checker virtinst
$ virsh net-destroy default
  1. virsh net-define –file maas-provisioning.xml
  2. virsh net-start maas-provisioning
  3. virsh net-autostart maas-provisioning

maas-provisioning.xml

 <network>
 <name>maas-provisioning</name>
 <forward mode='bridge'/>
 <bridge name='br0'/>
</network>

Repeat the above procedure for the following networks.

maas-provisioning.xml —> maas-provisioning —> br0

openstack-mgmt.xml –> openstack-mgmt —> br-mgmt

openstack-vlan.xml –> openstack-vlan  —> br-vlan

openstack-vxlan.xml –> openstack-vxlan —> br-vxlan

openstack-storage.xml –> openstack-storage —> br-storage

Install VM’s

 <network>
 <name>maas-provisioning</name>
 <forward mode='bridge'/>
 <bridge name='br0'/>
</network>
Advertisements

Author: Dilip Renkila

A Cloud enthusiast.

1 thought on “Deploying OpenStack with MAAS and Ansible”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s