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)

Deploying a sample application

Let's deploy our phonebook application. Since DigitalOcean does not offer a managed database service, we will deploy the SQLite variant of our application. Since we are going to use dynamic inventory, we will create the playbook as follows:

---
- hosts: app
roles:
- phonebook

How to do it...

To execute the playbook, along with dynamic inventory, we should execute the following command:

$ ansible-playbook -i digital_ocean.py --become phonebook.yml

This command installs the phonebook on our droplet. We can leverage the load balancer and provide the IP address of the load balancer instead of the droplet. Keep in mind that we are using SQLite here, not MySQL; SQLite is not accessible over...