Openstack Ansible AIO

Sai Ram Naragoni
4 min readMar 19, 2019

Problems with Devstack :

  • Devstack is made for development purposes. It is not suitable to be used in production environment.
  • It has a single script which installs all the required services. In case after installation, any openstack service goes down due to some fatal error, the only way to recover is to reinstall each and every service overwriting the existing configuration.
  • Even if the system crashes or reboots, most of the devstack services break and wont’t work properly like for example glance and swift.
  • Devstack must be used for proof of concept of openstack or for quick development purpose.

Why Openstack Ansible ?

  • Openstack ansible uses the power of ansible playbooks to deploy openstack.
  • It installs the openstack components in the LXC containers , which provides complete OS Level isolation between the openstack services.
  • Unlike devstack, ansible is used to deploy openstack in production environment.
  • Maintaining of openstack deployed using ansible is very easy and a takes a of couple of minutes to reinstall any service during maintainence.
  • Changing the configuration of a service is also feasible with openstack-ansible deployment.

OPENSTACK — ANSIBLE AIOINSTALLATION GUIDE

Minimum required configuration :

  • 8 vCPUs
  • 50GB free disk space on the root partition
  • 8GB RAM

Recommended Configuration :

  • CPU/motherboard that supports hardware-assisted virtualization
  • 8 CPU Cores
  • 80GB free disk space on the root partition, or 60GB+ on a blank secondary disk.
  • 16GB RAM

Installation :

Prepare the Host :

All the packages on the host machine needs to be upgraded, so execute the following commands as a root user. Please note that this installation guide is for Ubuntu distribution.

# apt-get dist-upgrade
# reboot

Bootstrap Ansible and the required roles :

Clone the openstack-ansible repository into the /opt/openstack_ansible directory.

# git clone https://git.openstack.org/openstack/openstack-ansible /opt/openstack-ansible# cd /opt/openstack-ansible

Checkout the stable branch of your requirement or by using any tag

For Ex :

# git checkout stable/rocky

Run the following script :

# scripts/bootstrap-ansible.sh

Bootstrap the AIO configuration.

# scripts/bootstrap-aio.sh

The above command creates the following path /etc/openstack_deploy

Now, if you want to add any other services over the default services, For example, in order to add horizon, sahara and swift services run the following script

# cp etc/openstack_deploy/conf.d/{horizon,sahara,swift}.yml.aio /etc/openstack_deploy/conf.d/for f in $(ls -1 /etc/openstack_deploy/conf.d/*.aio); do mv -v ${f} ${f%.*}; done

Run the playbooks :

# cd /opt/openstack-ansible/playbooks# openstack-ansible setup-hosts.yml# openstack-ansible setup-infrastructure.yml# openstack-ansible setup-openstack.yml
  • The setup-hosts.yml, creates the containers for each service that is to be installed on the host machine. It also installs the common requirements in the containers.
  • The setup-infrastructure.yml, configures the infrastructure services required for the openstack. All the required git repositories of the openstack services are cloned and stored in the repository server. The galera server for sql database management is configured. Rabbitmq server and rsyslog are also installed in this playbook.
  • The setup-openstack.yml, this playbook installs the openstack services that are specified earlier one by one in the corresponding containers.

If everything goes as intended without any errors, the openstack horizon dashboard should be available at your host IP.

During installation of the above three playbooks, in case any of the playbook throws an error — then note which container/service is throwing the error and reinstall that particular faulty container/service , then re-run the playbook.

How to reinstall a container :

Say, there is an error in the horizon container, get the container ID by running the following command

# lxc-ls

then run the below commands for the corresponding container to clean it out.

# lxc-stop -n aio1_horizon_container-1c29b052# lxc-destroy -n aio1_horizon_container-1c29b052# rm -rf /openstack/aio1_horizon_container-1c29b052/*

To re-configure the horizon container and necessary dependencies again, run the below command.

# openstack-ansible/playbooks# openstack-ansible setup-hosts.yml -l aio1 -l aio1_horizon_container-1c29b052# openstack-ansible setup-infrastructure.yml — limit aio1_horizon_container-1c29b052

Ansible allows users to install any particular service individually as well. In case of Horizon, run the following playbook.

# openstack-ansible os-horizon-install.yml

At any stage, the error status of the above playbooks during installation or health-check of the system hosts/infrastructure/services after installation can be verified by running the following playbooks

healthcheck-hosts.yml

healthcheck-infrastructure.yml

healthcheck-openstack.yml

Ex :

# openstack-ansible healthcheck-hosts.yml 

The above command checks for any faulty containers and displays the error accordingly.

Every time, the system is rebooted the galera cluster needs to be reinstalled. Before reinstalling make sure the haproxy service is up and running. This is applicable even during installation, after running the playbook setup-infrastructure.yml if the system gets shut down due to any unforeseen reason, then run the below commands before going for re-installing openstack services. If required, install haproxy service then install galera.

# cd openstack-ansible/playbooks# systemctl start haproxy.service# openstack-ansible -e galera_ignore_cluster_state=true galera-install.yml

--

--