Adding a compute host using OpenStack-Ansible

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.

Getting ready

In order to add a compute host to an OpenStack cluster using openstack-ansible, you will need the following information:

  • The IP address of the host
  • SSH access to the host
  • The SSH key from your deployment host
  • Access to the deployment host

The values used in our example are as follows:

  • Compute host: 172.29.236.15
  • Deployment host: controller-01.cook.book

We assume that your environment was already installed using OpenStack-Ansible as described in Chapter 1, Installing OpenStack with Ansible.

How to do it…

To install and configure an additional compute host using openstack-ansible, carry out the following steps:

  1. From the deployment host, add the additional compute host to the /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
  2. Run setup-hosts.yml, limiting the tasks to just compute-03:
    cd /opt/openstack-ansible/playbooks
    openstack-ansible setup-hosts.yml --limit compute-03
    
  3. Have Ansible gather facts about the new host:
    ansible nova_all -m setup -a 'filter=ansible_local gather_subset="!all"'
    
  4. Simply run os-nova-install.yml to install and configure nova-compute on our new compute host:
    openstack-ansible os-nova-install.yml --limit compute-03
    

    Tip

    Should the openstack-ansible command fail, the -v flag can be used to increase verbosity to assist in troubleshooting. Adding -v multiple times will provide additional levels of detail.

  5. Confirm the new hypervisor by running the following commands on any of the controller servers (as they run the utility container):
    lxc-attach --name $(lxc-ls -1 | grep utility)
    source openrc
    openstack hypervisor list
    

    This should bring back output like the following:

    How to do it…

How it works…

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.

Tip

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/

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.104.250