Pcornel
Technology Comparisons

Ansible vs Terraform

Compare configuration management with infrastructure provisioning tools.

DimensionAnsibleTerraformWhat it means in practice
Primary jobConfigure systems and devices (packages, files, services, device config).Create and change infrastructure resources (VMs, networks, cloud services).Many teams use Terraform to create and Ansible to configure.
ModelOrdered tasks in playbooks; modules aim to be idempotent.Declarative resources with a dependency graph.Terraform plans the whole change before applying.
StateNo state file; reads current state from targets.State file maps resources to real objects.Protect and lock Terraform state; it may contain secrets.
ConnectionSSH, WinRM or network device APIs; agentless.Provider APIs.Ansible needs reachability to each host.
Preview--check and --diff (if modules support it).terraform plan.Review plans in CI before apply.
Verificationansible-playbook site.yml --check --diffterraform plan -detailed-exitcodeExit code 2 from plan means changes are pending.

← All comparisons

Confirmation

Confirm action

Continue?