Multicloud management with Ansible


Preparing the Application Rollout

Before the application rollout on the newly created machines, it's time for some housekeeping. In addition to the usual steps, such as configuring repositories; installing runtimes and dependencies; and creating users, groups, and rights, you need to register the systems with a dynamic DNS (DDNS) server that is independent of the cloud provider. In this way, you can always reach the application with its own DNS name. A suitable playbook refers to previously declared roles for the application rollout (Listing 7).

Listing 7

Playbook for Application Rollout

- hosts: all
   remote_user: ssh-user
   become: yes
   - name: DDNS
     include_role: name: common
   - name: Common Config
     include_role: name: common
   - name: Config Database
     include_role: name: database
     when: purpose=="database"
   - name: Config Webserver
     include_role: name: nginx
     when: purpose=="webserver"

The ssh-user matches the key pair of the target servers. If your company has different users for GCP and AWS, you can also declare ssh-user as a variable in the inventory. The DDNS and Common Config tasks run on all rolled-out machines. Then, you can use the when filter to assign the roles only to the machines with the appropriate purpose. If you have not yet written your own roles for application rollouts in Ansible, the community repository, Galaxy [2], provides many prebuilt roles for the usual suspects, such as PostgreSQL, MariaDB, Apache, and Nginx.


With Ansible as an automation tool and an abstraction layer – in this case, a neutral inventory file – administrators can set up their cloud rollouts independent of the vendor. Only the automation part that works directly with the VMs in each cloud remains vendor dependent. However, managing the applications running on the cloud resources has nothing to do with the underlying virtualization layer. The strategy presented here can therefore also be extended to include local virtualizations (e.g., with vSphere or Red Hat Virtualization).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs

Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>


		<div class=