OpenStack Administration with Ansible
()
About this ebook
About This Book
- Automate real-world OpenStack cloud operator administrative tasks
- Construct a collection of automation code to save time on managing your OpenStack cloud
- Use this step-by-step tutorial to automate such tasks with Ansible
Who This Book Is For
If you are an OpenStack-based cloud operator and/or infrastructure administrator and are interested in automating administrative functions, then this book is exactly what you are looking for. Having a functioning OpenStack environment is helpful, but most certainly not necessary.
What You Will Learn
- Efficiently execute OpenStack administrative tasks
- Familiarize yourself with how Ansible works and assess the defined best practices
- Create Ansible playbooks and roles
- Automate tasks to customize your OpenStack cloud
- Review OpenStack automation considerations when automating administrative tasks
- Examine and automate advanced OpenStack tasks and designated use cases
- Get a high-level overview of OpenStack and the current production-ready projects
- Deep dive into OpenStack CLI tools and find out how to use them
In Detail
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.
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—Ansible.
We will start with a brief overview of OpenStack and Ansible and highlight some best practices. Each chapter will provide an introduction to handling various Cloud Operator administration tasks such as creating multiple users/tenants, setting up Multi-Tenant Isolation, customizing your clouds quotas, taking instance snapshots, evacuating compute hosts for maintenance, and running cloud health checks, and a step-by-step tutorial on how to automate these tasks with Ansible.
Style and approach
This easy-to-follow reference guide is packed with examples of real-world OpenStack administration tasks; each task is explained in detail and then subsequently turned into automation code.
Related to OpenStack Administration with Ansible
Related ebooks
OpenStack Networking Essentials Rating: 0 out of 5 stars0 ratingsOpenStack Essentials Rating: 0 out of 5 stars0 ratingsTroubleshooting OpenStack Rating: 0 out of 5 stars0 ratingsMastering OpenStack Rating: 1 out of 5 stars1/5Learning Puppet for Windows Server Rating: 0 out of 5 stars0 ratingsAnsible Playbook Essentials Rating: 0 out of 5 stars0 ratingsVagrant Virtual Development Environment Cookbook Rating: 5 out of 5 stars5/5Zabbix Network Monitoring Essentials Rating: 0 out of 5 stars0 ratingsLearning CoreOS Rating: 0 out of 5 stars0 ratingsImplementing Cloud Design Patterns for AWS Rating: 0 out of 5 stars0 ratingsCentOS System Administration Essentials Rating: 0 out of 5 stars0 ratingsLearning Puppet Rating: 0 out of 5 stars0 ratingsApache ZooKeeper Essentials Rating: 5 out of 5 stars5/5Monitoring Docker Rating: 0 out of 5 stars0 ratingsMastering Ceph Rating: 0 out of 5 stars0 ratingsGetting Started with Kubernetes - Second Edition Rating: 0 out of 5 stars0 ratingsCreating Development Environments with Vagrant - Second Edition Rating: 0 out of 5 stars0 ratingsNginx Essentials Rating: 0 out of 5 stars0 ratingsOpenStack Administration with Ansible 2 - Second Edition Rating: 0 out of 5 stars0 ratingsOpenStack Object Storage (Swift) Essentials Rating: 0 out of 5 stars0 ratingsOpenStack Networking Cookbook Rating: 0 out of 5 stars0 ratingsNative Docker Clustering with Swarm Rating: 0 out of 5 stars0 ratingsProduction Ready OpenStack - Recipes for Successful Environments Rating: 0 out of 5 stars0 ratingsLearning OpenStack Networking (Neutron) Rating: 5 out of 5 stars5/5Kubernetes A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsCentOS High Performance Rating: 0 out of 5 stars0 ratingsMastering Ansible Rating: 5 out of 5 stars5/5Learn Docker - .NET Core, Java, Node.JS, PHP or Python: Learn Collection Rating: 5 out of 5 stars5/5
Computers For You
Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 4 out of 5 stars4/5Algorithms to Live By: The Computer Science of Human Decisions Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5The Alignment Problem: How Can Machines Learn Human Values? Rating: 4 out of 5 stars4/5Storytelling with Data: Let's Practice! Rating: 4 out of 5 stars4/5Narrative Design for Indies: Getting Started Rating: 4 out of 5 stars4/5Python for Finance Cookbook: Over 50 recipes for applying modern Python libraries to financial data analysis Rating: 0 out of 5 stars0 ratingsGet Into UX: A foolproof guide to getting your first user experience job Rating: 4 out of 5 stars4/5Python for Beginners: A Crash Course to Learn Python Programming in 1 Week Rating: 0 out of 5 stars0 ratingsHow Do I Do That In InDesign? Rating: 5 out of 5 stars5/5The Unaccountability Machine: Why Big Systems Make Terrible Decisions - and How The World Lost its Mind Rating: 0 out of 5 stars0 ratingsPython Machine Learning By Example Rating: 4 out of 5 stars4/5ITIL® 4 Essentials: Your essential guide for the ITIL 4 Foundation exam and beyond, second edition Rating: 5 out of 5 stars5/5Black Holes: The Key to Understanding the Universe Rating: 5 out of 5 stars5/5Advances in Financial Machine Learning Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Learn Algorithmic Trading: Build and deploy algorithmic trading systems and strategies using Python and advanced data analysis Rating: 0 out of 5 stars0 ratingsDeep Learning with PyTorch Rating: 5 out of 5 stars5/5Django Building Dynamic Website With Django : A Complete Step By Step Guide To Learn to Build Modern Web Application with a Python Rating: 0 out of 5 stars0 ratingsArtificial Intelligence: The Complete Beginner’s Guide to the Future of A.I. Rating: 4 out of 5 stars4/5Learn SAP MM in 24 Hours Rating: 0 out of 5 stars0 ratingsThe ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 4 out of 5 stars4/5
Reviews for OpenStack Administration with Ansible
0 ratings0 reviews
Book preview
OpenStack Administration with Ansible - Bentley Walter
Table of Contents
OpenStack Administration with Ansible
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. An Introduction to OpenStack
OpenStack overview
The OpenStack foundation
Reviewing the OpenStack services
OpenStack Compute (codename Nova)
OpenStack Object Storage (codename Swift)
OpenStack Image Service (codename Glance)
OpenStack Identity (codename Keystone)
OpenStack Dashboard (codename Horizon)
OpenStack Networking (codename Neutron)
OpenStack Block Storage (codename Cinder)
OpenStack Orchestration (codename Heat)
OpenStack Telemetry (codename Ceilometer)
OpenStack Database (codename Trove)
OpenStack Data Processing (codename Sahara)
OpenStack Bare Metal Provisioning (codename Ironic)
OpenStack supporting components
Features and benefits
Fully distributed architecture
Uses commodity hardware
Scale horizontally or vertically
Meets high availability requirements
Compute isolation and multi-DC support
Robust role-based access control
Working examples – list the services and endpoints
Listing the OpenStack services
Via API
Via CLI
Listing the OpenStack endpoints
Via API
Via CLI
Summary
2. An Introduction to Ansible
Ansible overview
What are playbooks, roles, and modules?
Playbooks
Roles
Modules
Variables and facts
Variables
Setting variable placeholders
Defining variable values
Registering variables
Facts
Defining the inventory
Dynamic inventory
Summary
3. Creating Multiple Users/Tenants
Creating users and tenants
Manually creating users and tenants
Creating a user
Creating a tenant
Assigning users role and tenant access
Automation considerations
Defining variables globally or per role
The OpenStack API or CLI
Where to run Ansible
Coding the playbook and roles
The playbook and role review
Summary
4. Customizing Your Cloud's Quotas
Define and create quotas
Creating quotas manually
Setting up default quotas
Reset quota values
Automation considerations
Coding the playbook and roles
Playbook and role review
Summary
5. Snapshot Your Cloud
Define backups and snapshots
Creating backups and snapshots manually
Restore an instance backup
Automation considerations
Coding the playbook and roles
Playbook and role review
Summary
6. Migrating Instances
Instance migration
Manually migrating instances
Migrating an instance to a specific compute node
Automation considerations
Coding the playbook and roles
Playbook and role review
Summary
7. Setting up Isolated Tenants
Multi-tenant isolation explained
Setting up multi-tenant isolation
Pre-configuration steps
Step 1
Step 2
Tenant configuration steps
Step 1 – create a new or use an existing tenant
Step 2 – create new host aggregate
Step 3 – add hosts to the new host aggregate
Step 4 – update host aggregate metadata
Step 5 – create a custom flavor to include the tenant filter
Step 6 – apply volume type quotas
Automation considerations
Coding the playbook and roles
Playbook and role review
Summary
8. Deploying OpenStack Features
Multiple hypervisor support
What is Docker (aka Docker Engine)?
Setting up Docker and nova-docker
Docker configuration
Install Docker on a new compute node
Configuring nova-docker
Step 1 – install nova-docker
Step 2 – update the Nova compute_driver parameter
Step 3 – add the docker.filters file to the Nova rootwrap.d folder
Step 4 – add and remove filters on the compute node(s) Nova scheduler
Step 5 – add and remove filters on the controller node(s) Nova scheduler
Step 6 – create a custom Docker flavor with extra specs
Step 7 – create a new host aggregate for the Docker compute node(s)
Step 8 – add docker to the Glance API container_formats
Coding the playbook and roles
Install Docker
nova-docker
nova-update
openstack-config
nova-scheduler
glance-update
Playbook and role review
Summary
9. Inventory Your Cloud
Collecting cloud metrics
User report
Tenant report
Network report
Volume report
Cloud-at-a-glance report
Coding the playbook and roles
cloud-inventory
cloud-usage
user-inventory
tenant-inventory
network-inventory
volume-inventory
Playbook and role review
Summary
10. Health Check Your Cloud
Monitoring the cloud
OpenStack service processes
Infrastructure services
MariaDB and Galera
RabbitMQ
Core OpenStack services
Service and process check examples
Coding the playbook and roles
cloud-infra-check
cloud-core-os-check
os-service-status
Playbook and role review
Summary
Index
OpenStack Administration with Ansible
OpenStack Administration with Ansible
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2016
Production reference: 1210116
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-461-0
www.packtpub.com
Credits
Author
Walter Bentley
Reviewer
Diego Woitasen
Commissioning Editor
Veena Pagare
Acquisition Editor
Meeta Rajani
Content Development Editor
Susmita Sabat
Technical Editor
Madhunikita Sunil Chindarkar
Copy Editor
Sneha Singh
Project Coordinator
Milton Dsouza
Proofreader
Safis Editing
Indexer
Hemangini Bari
Production Coordinator
Shantanu N. Zagade
Cover Work
Shantanu N. Zagade
About the Author
Walter Bentley is a private cloud solutions architect with Rackspace. He has a diverse background in production systems administration and solutions architecture. He has over 15 years of experience across numerous industries, such as online marketing, finance, insurance, aviation, food, education, and now in technology product space. In the past, he has typically been the requestor, consumer, and advisor to companies in the use of technologies such as OpenStack. He is now a promoter of OpenStack technology and a cloud educator.
In Walter's current role, he is focused on helping customers build, design, and deploy private clouds built on OpenStack. His role also involves professional services, engagements around operating the built OpenStack clouds, and DevOps engagements creating playbooks/roles with Ansible.
Recently, Walter was given the honor to be present at the OpenStack Vancouver and Tokyo Summits. As well as this, he was given the great opportunity to present at AnsibleFest events in London and New York. Some of his other experiences involve performing webinars, blogging about OpenStack, and speaking at various technology conferences. Another wonderful experience is Walter being allowed to take part in the technical review of the newly launched OpenStack Cloud Computing Cookbook, Third Edition, Packt Publishing.
Acknowledgments
I would like to thank my wife and best friend, Tasha, for allowing me to take on this life-changing opportunity; I don't think it would have been possible without her understanding and support. She is truly my life's motivation. Also, I wish to thank my wonderful daughters, London and Rio, for bringing so much joy to our lives. I would like to thank my mother and father for cultivating the technical spirit within me from a very early age (that Commodore 64 was definitely my springboard… LOL).
I would also like to thank my coworker and fellow architect Kevin Jackson, for providing me with the courage to take on this project. I also wish to say thanks and express my gratitude to all of my mentors over the years that I have had the privilege to work for; those individuals include David Bartlett, Tyrone Paige, Steve Contrabasso, and Mike Childress. Their multitude of great advice has allowed me to be where I am today.
About the Reviewer
Diego Woitasen has more than 10 years of experience in the Linux and open source consulting industry. He is (with Luis Vinay) the co-founder of http://flugel.it/, self-denominated infrastructure developers; they apply all those years of experience to help all sorts of companies to embrace the DevOps culture and the new movements related with interdisciplinary cooperative working environments.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Preface
As OpenStack is now being considered to be 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, it will not be the best method to handle larger cloud deployments. The need for a more automated approach to administer OpenStack is now clear. Most organizations are seeking methods to improve business agility and have realized that 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 IaaS capabilities that OpenStack has to offer coupled with Ansible, an easy to 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 have a look at the 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 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 of the best practices. Next, the beginning of each of the following chapters will allow you to become more familiar with handling cloud operator administration tasks, such as creating multiple users/tenants, setting up multi-tenant isolation, customizing your cloud's quotas, taking instance snapshots, deploying additional OpenStack features, running cloud health checks, and so on. Finally, each chapter will conclude with a step-by-step tutorial on how to automate these 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 a reader, you will be encouraged to put hands to the keyboard and give the tasks a try.
What this book covers
Chapter 1, An Introduction to OpenStack, is a high-level overview of OpenStack and the projects that make up this cloud platform. This introduction will set the level of the reader on the OpenStack components, concepts, and verbiage.
Chapter 2, An Introduction to Ansible, is a detailed review of Ansible, its features, and the best practices to use, in order to set a solid starting foundation. It reviews 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 automating such a process using Ansible.
Chapter 4, Customizing Your Cloud's Quotas, makes you understand what quotas are and how they are used to restrict your cloud's resources. It shows the reader how to create quotas manually in OpenStack. After that, it walks the reader through how to automate this process with Ansible to take into account when handle tasks for multiple tenants at the same time.
Chapter 5, Snapshot Your Cloud, shows you how to create snapshots of your cloud instances manually within OpenStack and how to automate this process using Ansible. It also lets you explore 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. It then demonstrates the required steps to automate this task while grouping instances together. It also shows the additional options that Ansible can offer in handling a task of this matter.
Chapter 7, Setting up Isolated Tenants, walks the reader through the concept of multi-tenant isolation functionality within OpenStack. It tells us about the building blocks of accomplishing this successfully and next demonstrate how to automate all the steps required to set it up. It emphasizes how automation of this level prevents incorrect configurations, missed steps, and provides an easily repeatable process.
Chapter 8, Deploying OpenStack Features, presents the process to add additional OpenStack features to your cloud with Ansible. We will use the example of multi-hypervisor support built into OpenStack, as an example to demonstrate how Ansible code can be created to deploy new features.
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 information and how that 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, demonstrates some useful tips and tricks on how to check the health of your cloud manually and leveraging Ansible to trigger hourly and/or daily reports.
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 OSA (OpenStack-Ansible) cloud running with the Juno 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 will still need to be running the OpenStack Juno release or better. You should also have Ansible version 1.6 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