Multicloud management with Ansible

Independence

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
   tasks:
   - 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.

Conclusions

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

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Explore automation-as-code with Ansible
    The Ansible automation tool makes it really easy to implement IT scenarios as code. We use structured YAML code to roll out Ansible in the form of AWX.
  • Jira, Confluence, and GitLab
    Jira, Confluence, and GitLab are very popular DevOps tools and often form the basis for agile work flows. With the right Ansible playbooks, Ubuntu can be turned into an agile work center.
  • Automating system configuration with Ansible AWX
    Ansible is a powerful tool for automating the configuration of computers across the network. Red Hat developed Ansible Tower as a handy interface for managing Ansible. AWX is the freely available, community version of Tower.
  • Keeping it simple – the Ansible automator
    The powerful Ansible automator comes without airs and graces, does without complex syntax, self-documents, and has no need to hide its light compared with Puppet and other configuration management tools.
  • The 10 best tricks for taming Ansible
    Ansible is considered by far the most practical automation tool, but in many places, quirks make life with the tool unnecessarily complicated. We reveal the 10 best tricks for Ansible on Linux.
comments powered by Disqus