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

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.

More from Cloud

Using advanced scan settings in the IBM Cloud Security and Compliance Center

5 min read - Customers and users want the ability to schedule scans at the timing of their choice and receive alerts when issues arise, and we’re happy to make a few announcements in this area today: Scan frequency: Until recently, the IBM Cloud® Security and Compliance Center would scan resources every 24 hours, by default, on all of the attachments in an account. With this release, users can continue to run daily scans—which is the recommended option—but they also have the option for…

5 min read

Modernizing child support enforcement with IBM and AWS

7 min read - With 68% of child support enforcement (CSE) systems aging, most state agencies are currently modernizing them or preparing to modernize. More than 20% of families and children are supported by these systems, and with the current constituents of these systems becoming more consumer technology-centric, the use of antiquated technology systems is archaic and unsustainable. At this point, families expect state agencies to have a modern, efficient child support system. The following are some factors driving these states to pursue modernization:…

7 min read

IBM Cloud Databases for Elasticsearch End of Life and pricing changes

2 min read - As part of our partnership with Elastic, IBM is announcing the release of a new version of IBM Cloud Databases for Elasticsearch. We are excited to bring you an enhanced offering of our enterprise-ready, fully managed Elasticsearch. Our partnership with Elastic means that we will be able to offer more, richer functionality and world-class levels of support. The release of version 7.17 of our managed database service will include support for additional functionality, including things like Role Based Access Control…

2 min read

Connected products at the edge

6 min read - There are many overlapping business usage scenarios involving both the disciplines of the Internet of Things (IoT) and edge computing. But there is one very practical and promising use case that has been commonly deployed without many people thinking about it: connected products. This use case involves devices and equipment embedded with sensors, software and connectivity that exchange data with other products, operators or environments in real-time. In this blog post, we will look at the frequently overlooked phenomenon of…

6 min read