Book Image

Ansible 2 Cloud Automation Cookbook

By : Aditya Patawari, Vikas Aggarwal
Book Image

Ansible 2 Cloud Automation Cookbook

By: Aditya Patawari, Vikas Aggarwal

Overview of this book

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.
Table of Contents (11 chapters)

Building a simple inventory

We need to have an inventory before we execute any commands or playbooks, so let's build an inventory and add a host to run some tasks.

How to do it...

The INVENTORIES tab is located on the top bar. A Demo Inventory has already been created for us. We will create a new inventory and add a host there. Let's click on the +ADD button and select inventory from the menu.

The new inventory page lets us define the name of the inventory and various parameters including variables. For example, for our cookbook inventory, we can add a variable, ansible_user, with the value as root. To add hosts and modify other tabs of the inventory, we'll have to save the inventory first.

Once we have saved...