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)

Executing ad-hoc commands

One of the simplest operations that we can do with Ansible is to execute ad-hoc commands, so let's go ahead and execute a command on the host that we added in the inventory.

How to do it...

To execute an ad-hoc command on any host, we need to do the following:

  1. We need to go to the Inventories tab from the top navigation bar and select the cookbook inventory.
  2. Once the inventory section opens up, we need to go to the Hosts tab and select the host on which we want to execute the command.
  3. After selecting the host, click on the RUN COMMANDS button.
  4. A form for executing commands will open up. We can choose the module to execute the command. For this example, we will select the shell module from the...