June 24, 2020 By Steve Strutt 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

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.

Was this article helpful?
YesNo

More from Cloud

Fortressing the digital frontier: A comprehensive look at IBM Cloud network security services

6 min read - The cloud revolution has fundamentally transformed how businesses operate. Its superior scalability, agility and cost-effectiveness have made it the go-to platform for organizations of all sizes. However, this shift to the cloud has introduced a new landscape of ever-evolving security threats. Data breaches and cyberattacks continue to hit organizations, making robust cloud network security an absolute necessity. IBM®, a titan in the tech industry, recognizes this critical need, provides a comprehensive suite of tools and offers unmatched expertise to fortify…

How well do you know your hypervisor and firmware?

6 min read - IBM Cloud® Virtual Private Cloud (VPC) is designed for secured cloud computing, and several features of our platform planning, development and operations help ensure that design. However, because security in the cloud is typically a shared responsibility between the cloud service provider and the customer, it’s essential for you to fully understand the layers of security that your workloads run on here with us. That’s why here, we detail a few key security components of IBM Cloud VPC that aim…

New IBM study: How business leaders can harness the power of gen AI to drive sustainable IT transformation

3 min read - As organizations strive to balance productivity, innovation and environmental responsibility, the need for sustainable IT practices is even more pressing. A new global study from the IBM Institute for Business Value reveals that emerging technologies, particularly generative AI, can play a pivotal role in advancing sustainable IT initiatives. However, successful transformation of IT systems demands a strategic and enterprise-wide approach to sustainability. The power of generative AI in sustainable IT Generative AI is creating new opportunities to transform IT operations…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters