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)

Managing Block Storage

Often, the default disk available on the droplet might not be enough. For such scenarios, DigitalOcean provides a block storage service that can be attached to a droplet as an additional disk. This storage is highly available and easily extendable. Using Ansible, we can create and attach the block storage to a droplet.

How to do it...

  1. Let's start by creating a 10 GB block. We have to specify the command, region, block_size, and volume_name. The authentication token is also required along with these details. Note that this task will only create the block but will not attach it to any of the droplets:
- digital_ocean_block_storage:
state: present
command: create
region: blr1
block_size...