In order to run instances, OpenStack Compute needs to be aware of the physical resources on which to run the instances. As OpenStack has grown and matured over time, the process for adding a host has also grown with it. OpenStack-Ansible provides a very convenient and consistent method for adding new compute hosts which allows you to scale your environment as your needs grow. A compute host runs the nova-compute
service and the hypervisor that spawns the appropriate instance type requested.
In order to add a compute host to an OpenStack cluster using openstack-ansible
, you will need the following information:
The values used in our example are as follows:
172.29.236.15
controller-01.cook.book
We assume that your environment was already installed using OpenStack-Ansible as described in Chapter 1, Installing OpenStack with Ansible.
To install and configure an additional compute host using openstack-ansible
, carry out the following steps:
/etc/openstack_deploy/openstack_user_config.yml
file, as shown in the following example:compute_hosts: compute-01: ip: 172.29.236.13 compute-02: ip: 172.29.236.14 compute-03: ip: 172.29 236.15
setup-hosts.yml
, limiting the tasks to just compute-03
:cd /opt/openstack-ansible/playbooks openstack-ansible setup-hosts.yml --limit compute-03
ansible nova_all -m setup -a 'filter=ansible_local gather_subset="!all"'
os-nova-install.yml
to install and configure nova-compute
on our new compute host:openstack-ansible os-nova-install.yml --limit compute-03
lxc-attach --name $(lxc-ls -1 | grep utility) source openrc openstack hypervisor list
This should bring back output like the following:
The /etc/openstack_deploy/openstack_user_config
file provides mappings of roles to hosts in our environment. Adding the IP address for compute-03.cook.book
to the compute_hosts
stanza, informs the openstack-ansible
command to apply the packages, settings, and so forth to the new host. It also adds any required configuration to the remainder of your environment.
A full discussion of the Openstack-Ansible playbooks is beyond the scope of this book. For additional information on the playbooks and how they operate, you can review their documentation here: https://docs.openstack.org/project-deploy-guide/openstack-ansible/pike/
18.226.98.208