Running the OpenStack-Ansible playbooks
To install OpenStack, we simply run the relevant playbooks. There are three main playbooks in total that we will be using:
setup-hosts.yml
setup-infrastructure.yml
setup-openstack.yml
Getting ready
Ensure that you are the root
user on the deployment host. In most cases, this is the first infrastructure controller node, infra01
.
How to do it…
To install OpenStack using the OpenStack-Ansible playbooks, you navigate to the playbooks
directory of the checked out Git repository, then execute each playbook in turn:
First change to the
playbooks
directory by executing the following command:cd /opt/openstack-ansible/playbooks
The first step is to run a syntax check on your scripts and configuration. As we will be executing three playbooks, we will execute the following against each:
openstack-ansible setup-hosts.yml --syntax-check openstack-ansible setup-infrastructure.yml --syntax-check openstack-ansible setup-openstack.yml --syntax-check
Now we will run the first playbook using a special OpenStack-Ansible wrapper script to Ansible that configures each host that we described in the
/etc/openstack_deploy/openstack_user_config.yml
file:openstack-ansible setup-hosts.yml
After a short while, you should be greeted with a PLAY RECAP output that is all green (with yellow/blue lines indicating where any changes were made), with the output showing all changes were OK. If there are issues, review the output by scrolling back through the output and watch out for any output that was printed out in red. Refer to the Troubleshooting the installation recipe further on in this chapter. If all is OK, we can proceed to run the next playbook for setting up load balancing. At this stage, it is important that the load balancer gets configured. OpenStack-Ansible installs the OpenStack services in LXC containers on each server, and so far we have not explicitly stated which IP address on the container network will have that particular service installed. This is because we let Ansible manage this for us. So while it might seem counter-intuitive to set up load balancing at this stage before we know where each service will be installed—Ansible has already generated a dynamic inventory ahead of any future work, so Ansible already knows how many containers are involved and knows which container will have that service installed. If you are using an F5 LTM, Brocade, or similar enterprise load balancing kit, it is recommended that you use HAProxy temporarily and view the generated configuration to be manually transferred to a physical setup. To temporarily set up HAProxy to allow an installation of OpenStack to continue, modify your
openstack_user_config.yml
file to include a HAProxy host, then execute the following:openstack-ansible install-haproxy.yml
If all is OK, we can proceed to run the next Playbook that sets up the shared infrastructure services as follows:
openstack-ansible setup-infrastructure.yml
This step takes a little longer than the first Playbook. As before, inspect the output for any failures. At this stage, we should have a number of containers running on each Infrastructure Node (also known and referred to as Controller Nodes). On some of these containers, such as the ones labelled Galera or RabbitMQ, we should see services running correctly on here, waiting for OpenStack to be configured against them. We can now continue the installation by running the largest of the playbooks—the installation of OpenStack itself. To do this, execute the following command:
openstack-ansible setup-openstack.yml
This may take a while to run—running to hours—so be prepared for this duration by ensuring your SSH session to the deployment host will not be interrupted after a long time, and safeguard any disconnects by running the Playbook in something like
tmux
orscreen
. At the end of the Playbook run, if all is OK, congratulations, you have OpenStack installed!
How it works…
Installation of OpenStack using OpenStack-Ansible is conducted using a number of playbooks. The first playbook, setup-hosts.yml
, sets up the hosts by laying down the container configurations. At this stage, Ansible knows where it will be placing all future services associated with OpenStack, so we use the dynamic inventory information to perform an installation of HAProxy and configure it for all the services used by OpenStack (that are yet to be installed). The next playbook, setup-infrastructure.yml
, configures and installs the base Infrastructure services containers that OpenStack expects to be present, such as Galera. The final playbook is the main event—the playbook that installs all the required OpenStack services we specified in the configuration. This runs for quite a while—but at the end of the run, you are left with an installation of OpenStack.
The OpenStack-Ansible project provides a wrapper script to the ansible
command that would ordinarily run to execute Playbooks. This is called openstack-ansible
. In essence, this ensures that the correct inventory and configuration information is passed to the ansible
command to ensure correct running of the OpenStack-Ansible playbooks.