bunchc / vagrant-ansible-osa-multi-node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Purpose

To spin up a multi node openstack-ansible lab.

The lab is designed to be run in a virtual environment, and to be useful when testing various scenarios. While designed to be generic enough to test most things, the following specific scenarios are addressed:

  • Release upgrades
  • Cells TODO
  • Ceph TODO

Requirements

This lab is designed to work with KVM/libvirt, VMware Workstation/Fusion, or Virtualbox. To do so it has the following software and hardware requirements.

Software

  • Ansible
  • Vagrant
  • One of the following:
  • Virtualbox
  • VMware Workstation
  • VMware Fusion
  • KVM/libvirt
  • The Vagrant plugin for the corresponding VM software:
    • Virtual box: none
    • VMware Workstation: vagrant plugin install vagrant-vmware-desktop && vagrant plugin license vagrant-vmware-desktop ~/license.lic
    • VMware Fusion: vagrant plugin install vagrant-vmware-desktop && vagrant plugin license vagrant-vmware-desktop ~/license.lic
    • KVM/libvirt: vagrant plugin install vagrant-libvirt

Hardware

The hardware required will vary based on how you configure the nodes within the lab. By default, there is one controller and two compute nodes with the following specs:

Controller:

Resource Amount
vCPU 4
Ram 16GB
Disk 100GB (25GB Used)

Compute:

Resource Amount
vCPU 4
Ram 8GB
Disk 100GB (10GB Used)

Environment

NOTE: The default deployment here is based on Ubuntu 18.04 and openstack-ansible 'stable/rocky'.

Adjusting VMs to spin up are defined in nodes.yml.

For ease of defining your environment you can adjust the variables defined in the Ansible playbook generate_environment.yml. And then execute the following to generate the required nodes.yml and group_vars/all/all.yml:

ansible-playbook generate_environment.yml

Example Ansible inventory which is generated when Spinning Up

# Generated by Vagrant

osa-comp-01 ansible_host=192.168.121.50 ansible_port=22 ansible_user='vagrant' ansible_ssh_private_key_file='/root/projects/vagrant-ansible-osa-multi-node/.vagrant/machines/osa-comp-c1-01/libvirt/private_key'
osa-comp-02 ansible_host=192.168.121.198 ansible_port=22 ansible_user='vagrant' ansible_ssh_private_key_file='/root/projects/vagrant-ansible-osa-multi-node/.vagrant/machines/osa-comp-c2-01/libvirt/private_key'
osa-controller-01 ansible_host=192.168.121.100 ansible_port=22 ansible_user='vagrant' ansible_ssh_private_key_file='/root/projects/vagrant-ansible-osa-multi-node/.vagrant/machines/osa-controller-01/libvirt/private_key'

[elkstack]
osa-comp-01
osa-comp-02
osa-controller-01

[compute]
osa-comp-01
osa-comp-02

[cell1]
osa-comp-01
osa-comp-02

[openstack]
osa-controller-01

Quick How-To

Spinning Up

To quickly spin up the environment, use the following commands:

git clone https://github.com/bunchc/vagrant-ansible-osa-multi-node.git
cd vagrant-ansible-osa-multi-node.git
vagrant up --no-provision && vagrant provision

Note: While this says 'quick', openstack-ansible itself can take quite a while to deploy. I've found this to be between 1.5 and 2 hours typically.

OpenStack

Once everything has been spun up you can connect to the controller as follows:

vagrant ssh osa-controller-01
sudo su -
lxc-attach --name $(lxc-ls -1 | grep util)

For example, to list the hypervisors Nova sees:

vagrant@osa-controller-01:~$ sudo su -
root@osa-controller-01:~# lxc-attach --name $(lxc-ls -1 | grep util)
root@osa-controller-01-utility-container-e9188b54:~# source openrc 
root@osa-controller-01-utility-container-e9188b54:~# openstack hypervisor list
+----+--------------------------------+-----------------+---------------+-------+
| ID | Hypervisor Hostname            | Hypervisor Type | Host IP       | State |
+----+--------------------------------+-----------------+---------------+-------+
|  1 | osa-comp-01.test.vagrant.local | QEMU            | 172.29.236.71 | up    |
|  2 | osa-comp-02.test.vagrant.local | QEMU            | 172.29.236.72 | up    |
+----+--------------------------------+-----------------+---------------+-------+

In order to connect to the OpenStack Dashboard, you will need to tunnel port 443 to the host where the lab is running. You can then connect to the OpenStack Dashboard.

Tearing Down

When you are done tear it all down easily...

./scripts/cleanup.sh

About


Languages

Language:Ruby 32.7%Language:Erlang 26.1%Language:Shell 14.5%Language:PowerShell 13.0%Language:Python 12.9%Language:Dockerfile 0.8%