Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenStack Cloud Computing Cookbook

You're reading from   OpenStack Cloud Computing Cookbook Over 100 practical recipes to help you build and operate OpenStack cloud computing, storage, networking, and automation

Arrow left icon
Product type Paperback
Published in Jan 2018
Publisher Packt
ISBN-13 9781788398763
Length 398 pages
Edition 4th Edition
Languages
Arrow right icon
Authors (4):
Arrow left icon
James Denton James Denton
Author Profile Icon James Denton
James Denton
Egle Sigler Egle Sigler
Author Profile Icon Egle Sigler
Egle Sigler
Cody Bunch Cody Bunch
Author Profile Icon Cody Bunch
Cody Bunch
Kevin Jackson Kevin Jackson
Author Profile Icon Kevin Jackson
Kevin Jackson
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

OpenStack Cloud Computing Cookbook Fourth Edition
Contributors
Preface
Another Book You May Enjoy
1. Installing OpenStack with Ansible FREE CHAPTER 2. The OpenStack Client 3. Keystone – OpenStack Identity Service 4. Neutron – OpenStack Networking 5. Nova – OpenStack Compute 6. Glance – OpenStack Image Service 7. Cinder – OpenStack Block Storage 8. Swift – OpenStack Object Storage 9. OpenStack Orchestration Using Heat and Ansible 10. Using OpenStack Dashboard Index

Troubleshooting the installation


Ansible is a tool, written by people, that runs playbooks, written by people, to configure systems that would ordinarily be manually performed by people, and as such, errors can occur. The end result is only as good as the input.

Typical failures either occur quickly, such as connection problems, and will be relatively self-evident, or after long running jobs that may be as a result of load or network timeouts. In any case, the OpenStack-Ansible playbooks provide an efficient mechanism to rerun playbooks without having to repeat the tasks it has already completed.

On failure, Ansible produces a file in /root (as we're running these playbooks as root) called the playbook name, with the file extension of .retry. This file simply lists the hosts that had failed so this can be referenced when running the playbook again. This targets the single or small group of hosts, which is far more efficient than a large cluster of machines that successfully completed.

How to do it...

We will step through a problem that caused one of the playbooks to fail.

Note the failed playbook and then invoke it again with the following steps:

  1. Ensure that you're in the playbooks directory as follows:

    cd /opt/openstack-ansible/playbooks
    
  2. Now rerun that Playbook, but specify the retry file:

    ansible-openstack setup-openstack.yml --retry /root/setup-openstack.retry
    
  3. In most situations, this will be enough to rectify the situation, however, OpenStack-Ansible has been written to be idempotent—meaning that the whole playbook can be run again, only modifying what it needs to. Therefore, you can run the Playbook again without specifying the retry file.

Should there be a failure at this first stage, execute the following:

  1. First remove the generated inventory files:

    rm -f /etc/openstack_deploy/openstack_inventory.json
    rm -f /etc/openstack_deploy/openstack_hostnames_ips.yml
    
  2. Now rerun the setup-hosts.yml playbook:

    cd /opt/openstack-ansible/playbooks
    openstack-ansible setup-hosts.yml
    

In some situations, it might be applicable to destroy the installation and begin again. As each service gets installed in LXC containers, it is very easy to wipe an installation and start from the beginning. To do so, carry out the following steps:

  1. We first destroy all of the containers in the environment:

    cd /opt/openstack-ansible/playbooks
    openstack-ansible lxc-containers-destroy.yml
    

    You will be asked to confirm this action. Follow the ons-screen prompts.

  2. We recommend you to uninstall the following package to avoid any conflicts with the future running of the playbooks, and also clear out any remnants of containers on each host:

    ansible hosts -m shell -a "pip uninstall -y appdirs"
    
  3. Finally, remove the inventory information:

    rm -f /etc/openstack_deploy/openstack_inventory.json 
    /etc/openstack_deploy/openstack_hostnames_ips.yml
    

How it works…

Ansible is not perfect and so are computers. Sometimes failures occur in the environment due to SSH timeouts, or some other transient failure. Also, despite Ansible trying its best to retry the execution of a playbook, the result might be a failure. Failure in Ansible is quite obvious—it is usually predicated by outputs of red text on the screen. In most cases, rerunning the offending playbook may get over some transient problems. Each playbook runs a specific task, and Ansible will state which task has failed. Troubleshooting why that particular task had failed will eventually lead to a good outcome. Worst case, you can reset your installation from the beginning.

You have been reading a chapter from
OpenStack Cloud Computing Cookbook - Fourth Edition
Published in: Jan 2018
Publisher: Packt
ISBN-13: 9781788398763
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime