Red Hat Training

A Red Hat training course is available for Red Hat OpenStack Platform

Chapter 3. Deployment

The following procedure involves the use of Ansible to enable Instance HA. For more information about Ansible, see Ansible Documentation.

3.1. Creating the Necessary Ansible Configuration Files

Enabling Instance HA through Ansible requires an inventory file and SSH arguments file. Both files pass the Ansible variables necessary for implementing Instance HA on your overcloud.

Inventory File

The inventory file lists the different target hosts for the ansible playbooks. It is divided into two sections: the first section lists each node (by name), along with the hostname, username, and private key file that Ansible should use for each playbook command. For example:

overcloud-controller-0 ansible_host=overcloud-controller-0 ansible_user=heat-admin ansible_private_key_file=/home/stack/.ssh/id_rsa

The second section lists each node under the following headings (or node types): compute, undercloud, overcloud, or controller.

Create an inventory file named /home/stack/hosts. The following sample demonstrates the syntax required for this:

undercloud ansible_host=undercloud ansible_user=stack ansible_private_key_file=/home/stack/.ssh/id_rsa
overcloud-compute-1 ansible_host=overcloud-compute-1 ansible_user=heat-admin ansible_private_key_file=/home/stack/.ssh/id_rsa
overcloud-compute-0 ansible_host=overcloud-compute-0 ansible_user=heat-admin ansible_private_key_file=/home/stack/.ssh/id_rsa
overcloud-controller-2 ansible_host=overcloud-controller-2 ansible_user=heat-admin ansible_private_key_file=/home/stack/.ssh/id_rsa
overcloud-controller-1 ansible_host=overcloud-controller-1 ansible_user=heat-admin ansible_private_key_file=/home/stack/.ssh/id_rsa
overcloud-controller-0 ansible_host=overcloud-controller-0 ansible_user=heat-admin ansible_private_key_file=/home/stack/.ssh/id_rsa





To generate a complete inventory of all hosts in both undercloud and overcloud, run the following command:

stack@director $ tripleo-ansible-inventory --list

This command will generate a detailed and updated inventory in JSON format. See Running Ansible Automation for more details.

SSH Arguments File

The SSH arguments file passes the necessary credentials and authentication settings needed by Ansible to run the playbooks on each target host.

Create an SSH arguments file using the following commands (from /home/stack):

stack@director $ cat /home/stack/.ssh/ >> /home/stack/.ssh/authorized_keys
stack@director $ echo -e "Host undercloud\n Hostname\n IdentityFile /home/stack/.ssh/id_rsa\n User stack\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null\n" > ssh.config.ansible
stack@director $ source /home/stack/stackrc
stack@director $ openstack server list -c Name -c Networks | awk '/ctlplane/ {print $2, $4}' | sed s/ctlplane=//g | while read node; do node_name=$(echo $node | cut -f 1 -d " "); node_ip=$(echo $node | cut -f 2 -d " "); echo -e "Host $node_name\n Hostname $node_ip\n IdentityFile /home/stack/.ssh/id_rsa\n User heat-admin\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null\n"; done >> ssh.config.ansible

These commands will result in the creation of an SSH arguments file named /home/stack/ssh.config.ansible, which will contain host-specific connection options for each overcloud node. For example:

Host overcloud-controller-0
    IdentityFile /home/stack/.ssh/id_rsa
    User heat-admin
    StrictHostKeyChecking no

3.2. Preparing the Undercloud

After creating the inventory file and SSH arguments file (from Section 3.1, “Creating the Necessary Ansible Configuration Files”), you can now prepare the overcloud for Instance HA:

  1. Log in to the undercloud as the stack user.
  2. Download this TAR archive to /home/stack/. It contains the playbooks, roles, and other utilities necessary for enabling Instance HA through Ansible.


    The TAR archive provided here is a tested and modified version of an upstream GIT repository. To clone this repository, run:

    stack@director $ git clone git://

    This repository may be updated without notice, and therefore may be different from the archive available in this step.

  3. Extract the TAR archive:

    stack@director $ tar -xvf ansible-instanceha.tar
  4. Create /home/stack/ansible.cfg with the following contents:

    roles_path = /home/stack/ansible-instanceha/roles
  5. Export the ansible.cfg, hosts (the inventory file), and ssh.config.ansible (the SSH arguments file) to the following environment variables:

    stack@director $ export ANSIBLE_CONFIG="/home/stack/ansible.cfg"
    stack@director $ export ANSIBLE_INVENTORY="/home/stack/hosts"
    stack@director $ export ANSIBLE_SSH_ARGS="-F /home/stack/ssh.config.ansible"
  6. Ensure that the node definition template of the overcloud (by default, instackenv.json) is located in /home/stack/. For more information about the node definition template, see Registering Nodes for the Overcloud.

3.3. Enabling Instance HA

Once the undercloud is fully prepared, you can now run the prescribed playbooks you downloaded and extracted in Section 3.2, “Preparing the Undercloud”. These playbooks allow you to enable Instance HA with or without configuring STONITH for Controller and Compute nodes. For more information about STONITH, see Fencing the Controller Nodes.

In each of the following commands, replace RELEASE with the corresponding code for your version of Red Hat OpenStack Platform — namely, rhos-9.

To enable Instance HA and configure STONITH for both Controller and Compute nodes:

stack@director $ ansible-playbook /home/stack/ansible-instanceha/playbooks/overcloud-instance-ha.yml \
-e release="RELEASE"

By default, the playbook will install the instance-ha solution with shared storage enabled. If your overcloud does not use shared storage, use the instance_ha_shared_storage=false option:

stack@director $ ansible-playbook /home/stack/ansible-instanceha/playbooks/overcloud-instance-ha.yml \
-e release="RELEASE" -e instance_ha_shared_storage=false

See Section 2.1, “Exceptions for Shared Storage” for more information about shared storage in Instance HA.

To enable Instance HA without configuring STONITH for both Controller and Compute nodes:

stack@director $ ansible-playbook /home/stack/ansible-instanceha/playbooks/overcloud-instance-ha.yml \
-e release="RELEASE" -e stonith_devices=”none”

To enable Instance HA and configure STONITH only on Compute nodes (for example, if STONITH is already configured on the Controller nodes):

stack@director $ ansible-playbook /home/stack/ansible-instanceha/playbooks/overcloud-instance-ha.yml \
-e release="RELEASE" -e stonith_devices=”computes”