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 to browse the application on port 8080
of the GCE instance.
We may need to authorize the IP address of the GCE instance in the Cloud SQL so that it can connect to the database.
How it works...
Behind the scenes, this playbook will find the app instance and the database, and it...