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 the phonebook application

Let us deploy our phonebook app on Google Cloud Platform. We will use the GCE app instance and the MySQL Cloud SQL instance created in previous recipes. We will also use the dynamic inventory that we just used in the previous section.

How to do it...

Using the roles that we wrote in Chapter 1, Getting Started with Ansible and Cloud Management, we can create a playbook like this:

---
- hosts: tag_app
roles:
- phonebook

We need to update the vars/secrets.yml with the IP of the Cloud SQL instance's, root password that we setup in recipe12. We also need to set up an app password which will be used while creating the app user and the database. We execute the playbook and should be able...