« Previous 1 2 3
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).
Infos
- lorax-composer: https://weldr.io/lorax/lorax-composer/lorax-composer.html
- Ansible Galaxy: https://galaxy.ansible.com
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)