logo

Terraform vs Ansible

Last Updated: 2023-08-19
  • Terraform: specialized in provisioning and deprovisioning of cloud infrastructure.
  • Ansible: a more general tool that can be used for automation across various domains.

Terraform in Go, Ansible in Python.

Use Both

You can use both, e.g. use Terraform to provision resources on a public cloud, then run ansible to further setup.

  • Terraform (you write HCL): provision VM instances, networking (subnetwork, firewall etc), storage (disk); create ssh keys
  • Ansible (you write ansible playbooks in yaml): (now VMs are running), config VM instances (e.g. DNS), install software, manage sysmted services, create folders, download files.
  • Now the environment is fully setup.