Skip to content
BENIBIX Learn

Terraform vs Ansible

Terraform makes the cloud parts, like servers and networks. Ansible sets up what runs on a server, like its programs and files. Many teams use Terraform to make the servers. Then they use Ansible to set them up.

Development☁️ DevOps & Cloud

Terraform

A tool that builds cloud setups from text files. The files say what should exist.

Terraform is a tool that builds cloud setups from text files written in HCL. You describe what should exist, like a server or a database. terraform plan shows what it will add, change or delete. terraform apply then makes it so. It works with all the big cloud providers and hundreds of other services.

Example
Jack adds one server to his Terraform file. The plan says one thing will be added. Two minutes after apply, the server is there.
Why it matters
The plan shows each change first. A typo cannot quietly wipe a database.
Full entry
Development☁️ DevOps & Cloud

Ansible

A tool that sets up many servers at once. It reads its steps from a YAML file.

Ansible is an open-source tool for setting up servers and doing IT jobs. You write the steps in a playbook, a YAML file that reads almost like a list. Ansible connects to each server over SSH and runs the steps. It needs no extra program on the servers. If you run a playbook again, it changes only what is different.

Example
Lucy's playbook installs Nginx on five servers. She runs it once, and all five are set up in a minute.
Why it matters
One file sets up any number of servers the same way. Nothing extra goes on the servers.
Full entry

In one line

Terraform
A tool that builds cloud setups from text files. The files say what should exist.
Ansible
A tool that sets up many servers at once. It reads its steps from a YAML file.