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

IBM Tech Now: April 8, 2024

< 1 min read - ​Welcome IBM Tech Now, our video web series featuring the latest and greatest news and announcements in the world of technology. Make sure you subscribe to our YouTube channel to be notified every time a new IBM Tech Now video is published. IBM Tech Now: Episode 96 On this episode, we're covering the following topics: IBM Cloud Logs A collaboration with IBM watsonx.ai and Anaconda IBM offerings in the G2 Spring Reports Stay plugged in You can check out the…

The advantages and disadvantages of private cloud 

6 min read - The popularity of private cloud is growing, primarily driven by the need for greater data security. Across industries like education, retail and government, organizations are choosing private cloud settings to conduct business use cases involving workloads with sensitive information and to comply with data privacy and compliance needs. In a report from Technavio (link resides outside ibm.com), the private cloud services market size is estimated to grow at a CAGR of 26.71% between 2023 and 2028, and it is forecast to increase by…

Optimize observability with IBM Cloud Logs to help improve infrastructure and app performance

5 min read - There is a dilemma facing infrastructure and app performance—as workloads generate an expanding amount of observability data, it puts increased pressure on collection tool abilities to process it all. The resulting data stress becomes expensive to manage and makes it harder to obtain actionable insights from the data itself, making it harder to have fast, effective, and cost-efficient performance management. A recent IDC study found that 57% of large enterprises are either collecting too much or too little observability data.…

IBM Newsletters

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