Red Hat Ansible on IBM Cloud

2 min read

Use Red Hat Ansible with Terraform and IBM Cloud Schematics to deploy apps on IBM Cloud.

For those not familiar with Red Hat Ansible, it is a popular configuration management and provisioning tool. Based on Python and YAML, it is easy to learn and use, and it comes with an impressive catalog of pre-built content in Ansible Galaxy for provisioning and configuration of open source applications.

IBM Cloud Schematics brings the power of both Ansible and Terraform to IBM Cloud users to help automate the end-to-end deployment of cloud infrastructure and applications. By applying Infrastructure as Code (IaC) principles, Terraform and Ansible enable open-source-based apps to be deployed repeatably and reliably on IBM Cloud in minutes. 

Why to use both Ansible and Terraform for application provisioning on IBM Cloud

Why to use both Ansible and Terraform for application provisioning on IBM Cloud

For me, this lies in their very different approaches to provisioning and focus. I see the sweet spot of Terraform as being infrastructure orchestration and lifecycle management of infrastructure resources. Ansible, on the other hand, excels with configuration management and application provisioning. Any comparison or choice of tool also has to take into account how the application will be managed and upgraded. This leads onto the discussion of whether the infrastructure is to be treated as immutable or mutable—or, more prosaically, as “cattle or pets.” For a deeper discussion and comparison see my earlier blog, “Infrastructure as Code: Chef, Ansible, Puppet, or Terraform?” or “What is Infrastructure as Code (IaC)?” For some applications, or where its desired to reuse existing content from Ansible Galaxy, they make a good team (as represented in the figure above). 

To enable Terraform users to use Ansible for application configuration and provisioning, Schematics implements the Terraform pattern of a provisioner to extend Terraform’s base functionality. This brings the full potential of Ansible under the control of Terraform using the Ansible Provisioner for Terraform, delivering the ability to run Ansible playbooks, roles, and modules during the Terraform provisioning flow. Another benefit of using the provisioner, compared to calling Ansible via a script from within Terraform, is that it also masks many of the complexities of the SSH setup required to use Ansible. 

More details

For details on how to use the Ansible Provisioner for Terraform with Schematics for application provisioning, see the IBM Developer article “Learn about repeatable and reliable end-to-end app provisioning and configuration.”

To try it out, follow the companion example to demonstrate the use of out-of-the-box Ansible roles to install a multi-tier open source application and components onto VSIs in IBM Cloud.

If you have questions, engage our team via Slack by registering here and join the discussion in the #general channel on our public IBM Cloud Schematics Slack channel.

Be the first to hear about news, product updates, and innovation from IBM Cloud