Before we go with use-case of both terraform and ansible , lets first focus on basic .
Ansible is the open source software configuration management tool that provide simple but poweful automation for cross-platform computer support . This allows you to configure not just one computer, but potentially a whole network of computer at once , using it require no programming skills . It give’s instruction through modules . Modules are like small programs that ansible pushes out of the control machines to all the nodes . We use modules that executed using playbook . For more details you may visit official site .
Terraform is a open-source infrastructure as a code tool , mostly used for managing public cloud infrastructure such as AWS , GCP , Azure . It is distributed as a CLI and is used for writing declarative infrastructure as a code . For more details follow official site .
Terraform vs Ansible
- Assume the case when we want to setup the infrastructure for example set up instances or VPC on any cloud . If we do this all with ansible then every time we have to write playbook for creating , destroying infrastructure . Where as on the other hand in terraform we will simply write configuration file (which we call it as hashicrop configuration language) that will used to create , destroy the infrastructure .
- Terraform provide us state remote storage in which we can store our configuration where ever remotely . So that we have the backup of that files . where as ansible doesn’t support that .
- Terraform also provide locking system . In that only the single user can use the configuration at one time .
Use of terraform and ansible together
As we already discussed earlier that terraform is orchestration type tool and ansible is configuration management tool . In general practice people use terraform to set up the infrastructure and then use ansible to deploy any package that we need . The combination of both makes the process automated in devops practices . Terraform also support multi-cloud , this allows companies to leverage unique services that may only be available in one cloud provider . This helps reduce the risk of having all cloud assets depend on a single company .
1 thought on “When to go for ansible and when for terraform2 min read”
Comments are closed.