How to Prepare and Use Kolla Ansible


Introduction

Our Private Cloud Core deployments provide workload orchestration through the use of Kolla Ansible which deploys OpenStack services and infrastructure components in Docker containers. Should you want to make a change to an OpenStack service’s configuration, add a new OpenStack service, or even repair your OpenStack cluster, you can do so using Kolla Ansible. In this guide, you will learn how to prepare a Kolla Ansible environment, from which changes can be made.

Prequisites:

  • Experience working with Docker
  • Experience working with Ansible

Using Kolla Ansible

To start using Kolla Ansible, an environment needs to be created. This section explains the steps needed to create that environment.

Note! — Making changes using Kolla Ansible can potentially cause degradation of services or the cloud to be inoperable. Be careful!


Quick Start:

 

To get a quick idea of what is required, here is a high-level overview of the steps:

# Copy Kolla Ansible configuration from fm-deploy docker container
$ docker cp fm-deploy:/opt/kolla-ansible /opt/kolla-ansible

# Navigate to /opt/kolla-ansible
$ cd /opt/kolla-ansible

# Initialize a Python virtual environment
$ virtualenv .venv

# Activate the virtual environment
$ source .venv/bin/activate

# Update pip
pip install --upgrade pip

# Install Kolla Ansible using requirements.txt
$ pip install -r requirements.txt

Once prepared, make the needed changes and perform the Kolla Ansible run where <subcommand> is one in the list of available Kolla Ansible commands:

$ kolla-ansible -i /etc/fm-deploy/kolla-ansible-inventory <subcommand>

These steps are explained in more detail below.


Prepare and use Kolla Ansible

Follow these steps to learn how to prepare and use Kolla Ansible.


Relevant files:

 

  • Globals file: /etc/kolla/globals.yml
  • Inventory file: /etc/fm-deploy/kolla-ansible-inventory

Note! — The above files may not be present on each host. Inspect each host until you find the above, and perform the Kolla Ansible run from this host.


Before Making Changes

Before any changes are made to the Kolla Ansible configuration, the following variables in /etc/kolla/globals.yml should not be modified, otherwise they will be overwritten:

  • api_interface
  • cluster_interface
  • dns_interface
  • docker_registry_insecure
  • kolla_enable_tls_external
  • kolla_external_fqdn
  • kolla_external_vip_address
  • kolla_internal_vip_address
  • migration_interface
  • network_interface
  • neutron_external_interface
  • openstack_region_name
  • storage_interface
  • tunnel_interface

Prepare Kolla Ansible Environment

Step 1 – Prepare environment

From the Docker container called fm-deploy, copy /opt/kolla-ansible to the local file system:

$ docker cp fm-deploy:/opt/kolla-ansible /opt/kolla-ansible

 

Step 2 — Prepare Python virtual environment

Create a Python virtual environment from which Kolla Ansible will be used:

$ cd /opt/kolla-ansible
$ virtualenv .venv
$ source .venv/bin/activate

 

Step 3 — Update pip

If pip is not up to date, packages may not install.

Pip can be updated using:

pip install --upgrade pip

 

Step 4 — Install Kolla Ansible using requirements.txt

A requirements.txt file is used to install Kolla Ansible. The release of OpenStack your cloud is running will determine the version of Kolla Ansible to install. This means you need to inspect requirements.txt and ensure the right version of Kolla Ansible is installed.

At the time of writing this guide, the OpenStack release used in Private Cloud Core is Victoria.

To determine the release your cloud is using, as root from a hardware node, run docker ps to get a list of all Docker containers running. In that output is shown each OpenStack service’s image, appended with the OpenStack version.

For example:

$ docker ps
cf9e23cef540   harbor.imhadmin.net/kolla/centos-binary-mariadb-clustercheck:victoria        "dumb-init --single-…"   8 days ago    Up 8 days                                 mariadb_clustercheck
c19964a28b4e   harbor.imhadmin.net/kolla/centos-binary-mariadb-server:victoria              "dumb-init -- kolla_…"   8 days ago    Up 8 days                                 mariadb

In this output, the second column represents a Kolla Ansible image and there are two entries. The output has been truncated and you should see many more Docker containers running than two. At the end of the image name the version of OpenStack for which that image is built can be seen following the colon:

harbor.imhadmin.net/kolla/centos-binary-mariadb-clustercheck:victoria

The above indicates this OpenStack cloud is on the Victoria release.

Next, in a text editor load requirements.txt and uncomment the appropriate version for Kolla Ansible.

The contents of this file appears this way:

ansible>=2.9,<2.10,!=2.9.10

# Use one of the following supported OpenStack versions:
#git+https://github.com/openstack/[email protected]/train
#git+https://github.com/openstack/[email protected]/ussuri
#git+https://github.com/openstack/[email protected]/victoria

For the purpose of this demonstration, the OpenStack release is Victoria, so the #git+https://github.com/openstack/[email protected]/victoria line within this file needs to be uncommented, or, in other words, remove the prepended #.

The file should now appear this way:

ansible>=2.9,<2.10,!=2.9.10

# Use one of the following supported OpenStack versions:
#git+https://github.com/openstack/[email protected]/train
#git+https://github.com/openstack/[email protected]/ussuri
git+https://github.com/openstack/[email protected]/victoria

Now, requirements.txt is prepared and can be used to install Kolla Ansible:

(.venv) $ pip install -r requirements.txt

 

Step 5 — Make needed adjustments

This step is ultimately up to you to decide which action to take. Consider reviewing Kolla Ansible’s Operating Kolla user guide for examples of actions.

For a full list of available commands use kolla-ansible --help.

As an example, say you want to enable TLS for your Horizon. You will make the needed configuration changes first, then to implement the change you will use the reconfigure Kolla Ansible subcommand.

Another example of what can be using Kolla Ansible is you can redeploy certain portions of an OpenStack cloud. In the event a control plane node needs to be replaced, the Kolla Ansible deploy --tags rabbitmq subcommand can be used to redeploy RabbitMQ while preparing the cloud to receive the new member.


The remaining part of this section walks you through enabling central logging as an example.

 

To enable central logging, pull up /etc/kolla/globals.yml in a text editor, then change:

enable_central_logging: 'no'

to:

enable_central_logging: 'yes'

 

Step 6 — Perform the Kolla Ansible action

With enable_central_logging set to ‘yes’ use the Kolla Ansible subcommand reconfigure to enable central logging in your OpenStack cloud. Again, this is an example, and your action at this stage may vary depending on what you want to accomplish.

The base Kolla Ansible command takes this form:

kolla-ansible -i <path-to-inventory> <command>
  • <path-to-inventory> — This is /etc/fm-deploy/kolla-ansible-inventory
  • <command> — In this guide, reconfigure will be used.

Initiate the Kolla Ansible playbook:

$ kolla-ansible -i /etc/fm-deploy/kolla-ansible-inventory reconfigure

Next Steps

This concludes the steps needed to have a base understanding of how to use Kolla Ansible.

The following guides go into detail about specific things you can configure using Kolla Ansible, such enabling TLS for Horizon or enabling Central Logging:

NW
Nick West Systems Engineer

Nick is an avid aggressive inline skater, nature enthusiast, and loves working with open source software in a Linux environment.

More Articles by Nick

Comments

It looks like this article doesn't have any comments yet - you can be the first. If you have any comments or questions, start the conversation!

Was this article helpful? Let us know!