What are the differences between Terraform and Ansible?
Terraform is an open-source tool developed by HashiCorp that allows users to manage cloud services through a language named HashiCorp Configuration Language (HCL). Currently, Terraform supports 200 providers, including public cloud, private cloud, and SaaS providers.
There is also a paid product called Terraform Enterprise which provides support and extra governence.
Click here for Enterprise Pricing
Ansible is also an open-source product owned by IBM (RedHat) and is an IT automation and orchestration platform which was primarily used for Linux server admin, but is now being used heavily for network automation and windows management.
As with Terraform there is also a paid product called the Red Hat Ansible Automation Platform. Click here for Pricing
Both products are open source and free to use, however if you want to have the option of tighter security and support both have paid options.
Ansible vs Terraform For Network Automation
Whilst Terraform and Ansible share many similarities, both tools can deploy code and infrastructure in complex network environments.
However, they are very different tools in the way they operate.
Terraform operates in a declarative nature, you declare the state you want your infrastructure to be (via the Terraform file) and then let Terraform worry about how to make and push those changes.
With Ansible you have to define how to make each of the changes with different tasks in your playbook. In order to use Ansible, you need to know how you want to configure something so you can make Ansible do it.
Terraform vs Ansible at a glance
Push out the intent of a playbook. Ansible has no view of what has gone before.
Keeps a state and looks to ensure the config matches the state. Is aware of all previous changes.
|Very much focused on infrastructure automation.||More focused on cloud automation.|
|Modules are written in Python.||Providers are written in Go|
|Playbooks are written in YAML.||Terraform config file is written in HCL|
Hashicorp configuration language.
|Ansible is owned and developed by IBM (RedHat)||Terraform is owned and developed by Hashicorp|
|Ansible uses SSH to connect to devices||Terraform does not use SSH directly and expects a plugin or provider.|
Ansible is probably at this moment in time the best solution for network automation however Terraform has an ACI module which could be really helpful if you are spinning up large DC infrastructure which you need to replicate.