Unleashing the Potential of Multi-Cloud Automation with Ansible and Terraform

July 27, 2023 by Sean Cavanaugh

In today's rapidly evolving digital landscape, businesses are dependent on streamlined processes and efficient systems more than ever. One such revolutionary pathway towards a more efficient and flexible IT infrastructure is multi-cloud automation. In this blog, we will look at how to employ Ansible, a powerful automation tool, to tap into the immense potential of multi-cloud environments. We take you on a journey behind the scenes of our interactive labs, where our customers and prospects acquire hands-on experience with Ansible while exploring its newest features. In our labs, public clouds such as Google Cloud, AWS, and Microsoft Azure are showcased. Using Ansible we can orchestrate a symphony of seamless provisioning and optimal multi-cloud management. So, buckle up for a deep dive into the realm of multi-cloud automation, where complexity is simplified, and potential is unleashed.

The Ansible Technical Marketing team uses a variety of tools to create training labs and technical sales workshops for our field teams and customers. One of our training platforms includes Instruqt, an as-a-service learning platform, to help us create sandbox environments that can be run in your browser window. For technical tools behind the scenes, we use a combination of Ansible and Packer to build cloud images, while we use Terraform to help provision images and containers onto Google Cloud, then use Ansible to customize our labs on a per-lab basis. You might be wondering, Ansible and Terraform? Ansible and Terraform are two very powerful but unique open source IT tools that are often compared. I have wrote about them before in a previous blog, but it is sufficient to say that the two tools are better together and can work in harmony to create a better experience for developers and operations teams. We also employ GitHub as our source of truth, so you can look at our secret sauce online here.

One of the first things we do for a lab is talk about the environment. What are we trying to showcase? What virtual machines or containers do we need to run to showcase the demo? For example, if I want to showcase a network automation lab, I will need a Cisco router or an Arista switch. If I want to showcase Windows automation, I am going to need a Windows server virtual server. Even more interesting for this blog, how do we showcase cloud automation itself? How do I show multi-cloud? Instruqt actually has a built-in way to create ephemeral public cloud credentials. This means for any given lab session, we can create a Google Cloud, AWS or Microsoft Azure cloud account, with credentials for the duration of that lab. As soon as the lab is finished, it will delete the cloud and it will cease to exist.

To illustrate how this works, let's go ahead and look at a lab. One of the labs I love to showcase is hybrid cloud automation: AWS infrastructure visibility.  

In this lab you get access to three tabs. The first tab includes automation controller. This is the webUI for Red Hat Ansible Automation Platform and is running on Red Hat Enterprise Linux (RHEL) 9. For this lab we pre-built RHEL 9 with Ansible Automation Platform pre-installed so that the lab can boot up in minutes versus a normal fifteen minute installation.  To do this we ran a combination of packer and Ansible automation. Back in October, I wrote a blog post: Using Ansible and Packer, From Provisioning to Orchestration that shows how I can use the best of Packer and Ansible together to achieve really easy pipelines for creating virtual machine images. In our labs, we use a combination of Ansible (to install, set up and customize our controller image) and Packer (to publish the customized Google Cloud image).

When you launch the hybrid cloud automation: AWS infrastructure visibility lab, you are launching this pre-built automation controller image onto Google Cloud.  

In the second tab we have access to an ephemeral AWS public cloud account. Instruqt will set environment variables for automation controller for us to use how we see fit. As soon as a lab launches, we launch an Ansible Playbook to further customize the lab. Let’s see an example of how we can immediately take advantage of these environment variables:

- name: add aws credential to automation controller
    name: aws_credential
    description: Amazon Web Services
    organization: "Default"
    state: present
    credential_type: "Amazon Web Services"
    controller_username: "{{ username }}"
    controller_password: "{{ admin_password }}"
    controller_host: "https://{{ ansible_host }}"
    validate_certs: false  
      username: "{{ lookup('env','INSTRUQT_AWS_ACCOUNT_AWSACCOUNT_AWS_ACCESS_KEY_ID') }}"
      password: "{{ lookup('env','INSTRUQT_AWS_ACCOUNT_AWSACCOUNT_AWS_SECRET_ACCESS_KEY') }}"
  register: controller_try
  retries: 5
  until: controller_try is not failed     

When a student goes through the lab, they can see the credential is already pre-setup for them in automation controller:

In addition, Ansible Automation Platform will auto-provision two RHEL instances into AWS cloud. This effectively means, although we don’t advertise it, you are performing multi-cloud automation every time one of our hybrid cloud demos is performed. Automation controller is running on RHEL 9 on Google Cloud, but the virtual machines we are automating, as well as some operational cloud automation, are all on AWS. Here is a look at a simple diagram illustrating this point:

Now the lab simply walks the student through how to create automation jobs in automation controller to create some dynamic documentation:

Using Ansible Automation Platform, your organization can enact read-only operations that provide insight into what is running on your clouds and deliver immediate value without the risk of use cases that require production changes. Ansible Automation Platform makes it possible to aggregate information from your various environments and cloud services into a single, customizable management interface to help you understand your entire cloud environment. Through this unified management interface, you can use that information to create inventories and data reports to better inform your hybrid cloud management decisions.


Where do I go next?

Check out these resources to learn more:



AWS, Cloud Automation, Google Cloud


Sean Cavanaugh

Sean is a Senior Principal Technical Marketing Manager, Ansible, where he brings over 12 years of experience building and automating computer networks. Sean previously worked for both Cumulus Networks (acquired by Nvidia) and Cisco Systems where he helped customers deploy, manage and automate their network infrastructure. He resides in Chapel Hill, NC with his wife and children and tweets from @IPvSean.

rss-icon  RSS Feed