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)

Preparing to work with DigitalOcean

DigitalOcean has a very minimal setup. Some of the Ansible modules requires the dopy Python module.

How to do it...

The dopy Python module can be used for various DigitalOcean operations, so we have to install one dependency:

$ pip install dopy

Just like other Ansible modules for cloud providers, DigitalOcean modules need to interact with DigitalOcean APIs. Along with dopy, we need an authentication token from DigitalOcean to interact with its API:

  1. To generate a token, we need to visit the API settings URL in the DigitalOcean dashboard (https://cloud.digitalocean.com/settings/api/tokens).
  2. Click on the Generate New Token button. A form will ask us for the name of the token and scope.
  3. Since...