Book Image

OpenStack Administration with Ansible 2 - Second Edition

Book Image

OpenStack Administration with Ansible 2 - Second Edition

Overview of this book

Most organizations are seeking methods to improve business agility because they have realized just having a cloud is not enough. Being able to improve application deployments, reduce infrastructure downtime, and eliminate daily manual tasks can only be accomplished through some sort of automation. We start with a brief overview of OpenStack and Ansible 2 and highlight some best practices. Each chapter will provide an introduction to handling various Cloud Operator administration tasks such as managing containers within your cloud; setting up/utilizing open source packages for monitoring; creating multiple users/tenants; taking instance snapshots; and customizing your cloud to run multiple active regions. Each chapter will also supply a step-by-step tutorial on how to automate these tasks with Ansible 2. Packed with real-world OpenStack administrative tasks, this book will walk you through working examples and explain how these tasks can be automated using one of the most popular open source automation tools on the market today.
Table of Contents (17 chapters)
OpenStack Administration with Ansible 2 Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Preface

As OpenStack has begun to be considered more of a mainstream cloud platform, the challenge of operating it after it is built has become prevalent. While all cloud tasks can be executed via the API or CLI tool on a one-by-one basis, this would not be the best way to handle larger cloud deployments. The need for more of an automated approach to administering OpenStack is now clear. Most organizations are seeking methods to improve business agility and have realized just having a cloud is not enough. Being able to improve application deployments, reduce infrastructure downtime, and eliminate daily manual tasks can only be accomplished through some sort of automation. OpenStack and Ansible will help any organization close that gap. With the many Infrastructure-as-a-Service capabilities OpenStack has to offer coupled with Ansible, an ease of use configuration management tool, assures a more complete cloud implementation.

Whether you are new to OpenStack or a seasoned cloud administrator, this book will aid you in managing your OpenStack cloud once it is all set up. Packed with real-world OpenStack administrative tasks, we will first step through those working examples natively and then transition to walking through instructions on how to automate these tasks using one of the most popular open source automation tools, Ansible.

Ansible has become a market leader in the Open Source orchestration and automation space. With it too being built using Python, similar to OpenStack, it makes for an easy marriage. The ability to leverage existing and/or new OpenStack modules will allow you to quickly move along your playbook creation.

We will start with a brief overview of OpenStack and Ansible, highlighting some best practices. Next, the beginning of each following chapter will allow you to become more familiar with handling Cloud Operator administration tasks such as creating multiple users/tenants, managing containers, customizing your clouds quotas, taking instance snapshots, setting up active-active regions, running cloud health checks, and more. Finally, each chapter will conclude with a step-by-step tutorial on how to automate those tasks with Ansible. As an added bonus, the fully functional Ansible code will be published on GitHub for your reference while reviewing the chapter and/or for later review.

Consider this book to be a 2-for-1 learning experience, a deep OpenStack-based cloud administrative knowledge and familiarity with how Ansible works. As the reader, you will be encouraged to put hands to the keyboard and give the tasks a try.

What this book covers

Chapter 1, Introduction to OpenStack, provides the high-level overview of OpenStack and the projects that make up this cloud platform. This introduction will set the level for the reader on the OpenStack components, concepts, and verbiage.

Chapter 2, Introduction to Ansible, gives the detailed review of Ansible 2.0, its features, and the best practices to set a solid starting foundation. Also, it will review why leveraging Ansible to automate OpenStack tasks is the easiest option.

Chapter 3, Creating Multiple Users/Tenants, guides the reader through the process of creating users and tenants within OpenStack manually and the creation considerations in order to automate such a process using Ansible.

Chapter 4, Customizing Your Clouds Quotas, makes you understand what quotas are and how they are used to restrict your cloud resources. It shows the reader how to create quotas manually in OpenStack. After this, it explains how to automate this process with Ansible in order to handle the task for multiple tenants at one time.

Chapter 5, Snapshot Your Cloud, teaches how to create snapshots of your cloud instances manually within OpenStack and how to automate this process using Ansible. It explores the power of being able to snapshot all instances within a tenant in one shot.

Chapter 6, Migrating Instances, introduces the concept of migrating select instances across compute nodes in the traditional OpenStack method. Then, it demonstrates the required steps to automate this task while grouping instances together and shows the additional options Ansible can offer in handling a task of this matter.

Chapter 7, Managing Containers on Your Cloud, takes the reader through a few strategies on how you can automate building and deploying containers running on your OpenStack cloud. There are a few approaches now available, but the key is automating the process so that it is a reuseable function. For each approach, the chapter shows the building blocks of how to accomplish this successfully with OpenStack.

Chapter 8, Setting up Active-Active Regions, gives the detailed review of a few use cases of setting up an Active-Active OpenStack cloud regions. With that knowledge, you will then physically learn how to automate this to deploy onto your clouds.

Chapter 9, Inventory Your Cloud, explores how the reader can dynamically inventory all the OpenStack cloud user resources with one Ansible playbook. It walks them through the necessary metrics to gather and how that information can be stored for later reference. This is a very powerful tool to have as a cloud administrator/operator.

Chapter 10, Health Check Your Cloud with Nagios, demonstrates some useful tips and tricks on how to check the health of your cloud manually and leverage Ansible to set up Nagios and the necessary checks to monitor your cloud. Nagios is one of the leading open source monitoring platforms out there and compliments OpenStack and Ansible very well.

What you need for this book

In order to truly benefit from this book, it is best to have deployed or have access to an OpenStack cloud built using openstack-ansible (OSA) running with the Newton release or better. The OSA deployment method provides an environment that will install both OpenStack and Ansible.

If you plan to deploy any of the other OpenStack distributions, you would still just need to be running the OpenStack Newton release or better. As well as, have Ansible version 2.1 or better installed on the same nodes or on your workstation.

Also, having a good text editor, such as TextWrangler, Notepad++, or Vim, will be very useful if you plan to add to or edit any of the Ansible playbooks/roles found in the GitHub repository.

Who this book is for

If you are an OpenStack-based cloud operator and/or infrastructure administrator with basic OpenStack knowledge already and are interested in automating administrative functions, then this book is exactly what you are looking for. You will take your basic OpenStack knowledge to the next level by learning how to automate simple and advanced OpenStack administration tasks. Having a functioning OpenStack environment is helpful but most certainly not required.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can start from the top with the role we created named create-users-env."

A block of code is set as follows:

- name: User password assignment 
 debug: msg="User {{ item.0 }} was added to {{ item.2 }} project, with the assigned password of {{ item.1 }}" 
 with_together: 
  - userid 
  - passwdss.stdout_lines 
  - tenantid 

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

- name: User password assignment 
 debug: msg="User {{ item.0 }} was added to {{ item.2 }} project, with the assigned password of {{ item.1 }}" 
 with_together: 
  - userid 
  - passwdss.stdout_lines 
  - tenantid 

Any command-line input or output is written as follows:

$ source openrc
$ openstack user create --password-prompt <username>

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "View them via the Horizon dashboard under the Images tab."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support  and register to have the files e-mailed directly to you.

The complete set of code can also be downloaded from the following GitHub repository: https://github.com/PacktPublishing/OpenStack-Administration-with-Ansible-2.

The same code files are available at the author's repository, https://github.com/os-admin-with-ansible/os-admin-with-ansible-v2.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.