AIO setup of OpenStack – preparing the infrastructure code environment

Viewing your OpenStack infrastructure deployment as code will not only simplify node configuration, but also improve the automation process.

Despite the existence of numerous system-management tools to bring our OpenStack up and running in an automated way, we have chosen Ansible for automation of our infrastructure.

(For more resources related to this topic, see here.)

At the end of the day you can choose to use any automation tool that fits your production need, the key point to keep in mind is that to manage a big production environment you must simplify operation by:

  • Automating deployment and operation as much as possible
  • Tracking your changes in a version control system
  • Continuous integration of code to keep you infrastructure updated and bug free
  • Monitoring and testing your infrastructure code to make it robust.

We have chosen Git to be our version control system. Let's go ahead and install the Git package on our development system.

Check the correctness of the Git installation:

If you decide to use IDE like eclipse for you development, it might be easier to install a Git plugin to integrate Git to your IDE. For example, the EGit plugin can be used to develop with Git in Eclipse. We do this by navigating to the Help | Install new software menu entry. You will need to add the following URL to install EGit:

Preparing the development setup

The install process is divided into the following steps:

  1. Checkout the OSA repository.
  2. Install and bootstrap Ansible.
  3. Initial host bootstrap.
  4. Run playbooks.

Configuring your setup

The AIO development environment used the configuration files in the test/roles/bootstrap-host/defaults/main.yml file.

This file describes the default values for the host configuration. In addition to the configuration, file the configuration options can be passed through shell environment variables.

The BOOTSTRAP_OPTS variable is read by the bootstrap script as a space separated key-value pair. It can be used to pass values to override the default ones in the configuration file:

export BOOTSTRAP_OPTS="${BOOTSTRAP_OPTS} bootstrap_host_loopback_cinder_size=512"

OSA also allows overriding default values for service configuration. These override values are provides in the etc/openstack_deploy/user_variables.yml file.

The following is an example of overriding the values in nova.conf using the override file:

   remove_unused_original_minimum_age_seconds: 43200
   cpu_mode: host-model
   disk_cachemodes: file=directsync,block=none
   idle_timeout: 300
   max_pool_size: 10

This override file will populate the nova.conf file with the following options:

remove_unused_original_minimum_age_seconds = 43200

cpu_mode = host-model
disk_cachemodes = file=directsync,block=none

idle_timeout = 300
max_pool_size = 10

The override variables can also be passed using a per host configuration stanza in /etc/openstack_deploy/openstack_user_config.yml.

The complete set of configuration options are described in the OpenStack Ansible documentation at

Building the development setup

To start the installation process, execute the Ansible bootstrap script. This script will download and install the correct Ansible version. It also creates a wrapper script around ansible-playbook called openstack-ansible that always loads the OpenStack user variable files.

Next step is to configure the system for the all-in-one setup. This script does the following tasks:

  • Applies Ansible roles to install the basic software requirements like openSSH and pip.
  • It also applies the bootstrap_host role to check the hard-disk and swap space
  • Create various loopback volumes for use with Cinder, Swift and Nova
  • Prepares networking

Finally, we run the playbooks to bring up the AIO development environment. This script will execute the following tasks:

  • Creates the LXC containers
  • Applies security hardening to the host
  • Reinitiates the network bridges
  • Install the infrastructure services like MySQL, RabbitMQ, memcached, and more
  • Finally it installs the various OpenStack services

Running the playbooks take a long time to build the containers and start the OpenStack services. Once finished you will have all the OpenStack services running in their private container.

You can use the lxc-ls command to list the service containers on the development machine.

Use the lxc-attach command to connect to any container as shown here:

lxc-attach --name <name_of_container>

Use the name of the container from the output of lxc-ls to attach to the container. LXC commands can be used to star and stop the service containers.

The AIO environment brings MySQL cluster, which needs special care to start the MySQL cluster if the development machine is rebooted. Details of operating the AIO environment are available in the OpenStack Ansible QuickStart guide at

Tracking your changes

The OSA project itself is maintains its code under version control at the OpenStack git server (

The configuration files of OSA are stored at /etc/openstack_ansible/ on the deployment host. These files define the deployment environment and the user override variables. To make sure that you control the deployment environment it is important that the changes to these configuration files are tracked in a version control system.

To make sure that you track the development environment make sure that the Vagrant configuration files are also tracked in version control system.


So far, we’ve deployed a basic AIO setup of OpenStack. Mastering OpenStack Second Edition will take you through the process of extending our design by clustering, defining the various infrastructure nodes, controller, and compute hosts.

Resources for Article:

Further resources on this subject:

You've been reading an excerpt of:

Mastering OpenStack - Second Edition

Explore Title