Ansible 2 Cloud Automation Cookbook

Book description

Orchestrate your cloud infrastructure

About This Book

  • Recipe-based approach to install and configure cloud resources using Ansible
  • Covers various cloud-related modules and their functionalities
  • Includes deployment of a sample application to the cloud resources that we create
  • Learn the best possible way to manage and automate your cloud infrastructure

Who This Book Is For

If you are a system administrator, infrastructure engineer, or a DevOps engineer who wants to obtain practical knowledge about Ansible and its cloud deliverables, then this book is for you. Recipes in this book are designed for people who would like to manage their cloud infrastructures efficiently using Ansible, which is regarded as one of the best tools for cloud management and automation.

What You Will Learn

  • Use Ansible Vault to protect secrets
  • Understand how Ansible modules interact with cloud providers to manage resources
  • Build cloud-based resources for your application
  • Create resources beyond simple virtual machines
  • Write tasks that can be reused to create resources multiple times
  • Work with self-hosted clouds such as OpenStack and Docker
  • Deploy a multi-tier application on various cloud providers

In Detail

Ansible has a large collection of inbuilt modules to manage various cloud resources. The book begins with the concepts needed to safeguard your credentials and explain how you interact with cloud providers to manage resources. Each chapter begins with an introduction and prerequisites to use the right modules to manage a given cloud provider. Learn about Amazon Web Services, Google Cloud, Microsoft Azure, and other providers. Each chapter shows you how to create basic computing resources, which you can then use to deploy an application. Finally, you will be able to deploy a sample application to demonstrate various usage patterns and utilities of resources.

Style and approach

This book will help readers get started with Ansible cloud modules. It has code snippets and diagrams along with real world examples that will help you move ahead easily. Using real world scenarios, you will learn to deploy an application to cloud resources.

Publisher resources

View/Submit Errata

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Ansible 2 Cloud Automation Cookbook
  3. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  4. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Sections
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
    5. Get in touch
      1. Reviews
  6. Getting Started with Ansible and Cloud Management
    1. Introduction
      1. Infrastructure as Code
      2. Introduction of Ansible entities
    2. Installing Ansible
      1. How to do it…
    3. Executing the Ansible command line to check connectivity
      1. How to do it…
    4. Working with cloud providers
    5. Executing playbooks locally
      1. How to do it...
    6. Managing secrets with Ansible Vault
      1. How to do it…
    7. Understanding sample application
      1. How to do it…
    8. Using dynamic inventory
      1. How to do it…
  7. Using Ansible to Manage AWS EC2
    1. Introduction
    2. Preparing Ansible to work with AWS
      1. How to do it...
    3. Creating and managing a VPC
      1. How to do it...
    4. Creating and managing security groups
      1. How to do it...
      2. How it works...
    5. Creating EC2 instances
      1. Getting ready
      2. How to do it...
    6. Creating and assigning Elastic IPs
      1. How to do it...
      2. How it works...
    7. Attaching volumes to instances
      1. Getting ready
      2. How to do it...
    8. Creating an Amazon Machine Image
      1. How to do it…
    9. Creating an Elastic Load Balancer and attaching to EC2 instances
      1. How to do it…
    10. Creating auto scaling groups 
      1. How to do it...
    11. Deploying the phonebook application
      1. How to do it…
  8. Managing Amazon Web Services with Ansible
    1. Introduction
    2. Creating an RDS instance
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Creating and deleting records in Route53
      1. Getting ready
      2. How to do it...
      3. How it works...
    4. Managing S3 objects
      1. How to do it...
      2. How it works...
    5. Managing Lambda
      1. Getting ready
      2. How to do it...
      3. How it works...
    6. Managing IAM users
      1. How to do it...
      2. How it works...
    7. Using dynamic inventory
      1. How to do it...
    8. Deploying the sample application
      1. How to do it...
      2. How it works...
  9. Exploring Google Cloud Platform with Ansible
    1. Introduction
    2. Preparing to work with Google Cloud Platform
      1. How to do it…
    3. Creating GCE instances
      1. How to do it…
      2. How it works...
    4. Attaching persistent disks
      1. How to do it…
      2. How it works...
    5. Creating snapshots for backup
      1. How to do it…
      2. How it works...
    6. Tagging an instance
      1. How to do it…
    7. Managing network and firewall rules
      1. How to do it…
      2. How it works...
    8. Managing load balancer
      1. How to do it…
    9. Managing GCE images
      1. How to do it…
      2. How it works...
    10. Creating instance templates
      1. How to do it…
    11. Creating managed instance groups
      1. How to do it…
      2. How it works...
    12. Managing objects in Google Cloud Storage
      1. How to do it…
    13. Creating a Cloud SQL instance (without Ansible module)
      1. How to do it…
    14. Using dynamic inventory
      1. How to do it…
    15. Deploying the phonebook application
      1. How to do it…
      2. How it works...
  10. Building Infrastructure with Microsoft Azure and Ansible
    1. Introduction
    2. Preparing Ansible to work with Azure
      1. How to do it...
    3. Creating an Azure virtual machine
      1. How to do it...
      2. How it works...
    4. Managing network interfaces
      1. How to do it...
      2. How it works...
    5. Working with public IP addresses
      1. How to do it...
      2. How it works...
    6. Using public IP addresses with network interfaces and virtual machines
      1. How do it...
      2. How it works...
    7. Managing an Azure network security group
      1. How to do it...
      2. How it works...
    8. Working with Azure Blob storage
      1. How to do it...
      2. How it works...
    9. Using a dynamic inventory
      1. How to do it...
    10. Deploying a sample application
      1. How to do it...
  11. Working with DigitalOcean and Ansible
    1. Introduction
    2. Preparing to work with DigitalOcean
      1. How to do it…
    3. Adding SSH keys to a DigitalOcean account
      1. How to do it…
    4. Creating Droplets
      1. How to do it…
    5. Managing Block Storage
      1. How to do it…
    6. Attaching a Floating IP
      1. How to do it…
    7. Using a Load Balancer
      1. How to do it…
    8. Adding an A DNS record
      1. How to do it…
    9. Using dynamic inventory
      1. How to do it…
    10. Deploying a sample application
      1. How to do it…
  12. Running Containers with Docker and Ansible
    1. Introduction
    2. Preparing Ansible to work with Docker
      1. How to do it…
    3. Running a container 
      1. How to do it...
      2. How it works…
    4. Downloading Docker images 
      1. How to do it… 
      2. How it works…
    5. Mounting volumes in containers 
      1. How to do it…
      2. How it works…
    6. Setting up Docker Registry
      1. How to do it…
      2. How it works…
    7. Logging into Docker Registry 
      1. How to do it…
      2. How it works…
    8. Using Docker Compose to manage services
      1. How to do it… 
      2. How it works…
    9. Scaling up Compose-based service
      1. How to do it…
      2. How it works...
    10. Deploying a sample application 
      1. How to do it…
      2. How it works...
  13. Diving into OpenStack with Ansible
    1. Introduction
    2. Preparing Ansible to work with OpenStack
      1. How to do it…
    3. Adding a keypair
      1. How to do it…
    4. Managing security groups
      1. How to do it…
      2. How it works…
    5. Managing network resources
      1. How to do it…
      2. How it works…
    6. Managing a Nova compute instance
      1. How to do it…
      2. How it works… 
    7. Creating a Cinder volume and attaching it to a Nova compute instance 
      1. How to do it…
    8. Managing objects in Swift
      1. How to do it…
      2. How it works…
    9. User management
      1.  How to do it…
      2. How it works… 
    10. Creating a flavor
      1. How to do it…
    11. Adding an image
      1. How to do it…
      2. How it works…
    12. Dynamic inventory 
      1. How to do it…
    13. Deploying the phonebook application
      1. How to do it…
  14. Ansible Tower
    1. Introduction
    2. Installing Ansible Tower
      1. How to do it...
    3. Getting started with Tower
      1. How to do it...
    4. Adding a machine credential
      1. How to do it...
    5. Building a simple inventory
      1. How to do it...
    6. Executing ad-hoc commands
      1. How to do it...
    7. Using Ansible Tower with a cloud provider
      1. How to do it...
    8. Integrating Ansible roles with tower
      1. How to do it...
    9. Scheduling jobs
      1. How to do it...
    10. Ansible Tower API
      1. How to do it...
    11. Autoscaling using Callback
      1. How to do it...
  15. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Ansible 2 Cloud Automation Cookbook
  • Author(s): Aditya Patawari, Vikas Aggarwal
  • Release date: February 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788295826