Asset 20 8 2
Does AI recommend your business? Run the free check →

Join 15,000 business owners, marketers and entrepreneurs. The Sunday newsletter you'll be annoyed only arrives once a week.

Article

Ansible vs Terraform: Configuration vs Provisioning Explained

Use Terraform to create and change infrastructure, such as networks, virtual machines and DNS records, from code files, and use Ansible to configure the servers and software running on that infrastructure. Terraform works through a Write, Plan, Apply cycle against cloud APIs, while Ansible runs YAML playbooks over SSH with no agent to install. Plenty of teams use both: Terraform builds the environment and Ansible sets it up.

Both tools turn manual IT work into code, which is why they end up on the same shortlist. I read the Ansible community docs and Red Hat's Ansible Automation Platform page, plus HashiCorp's Terraform introduction, product and plans pages, to show where each one starts and stops.

Ansible and Terraform compared

AnsibleTerraform
Main jobConfigure systems and deploy softwareProvision and manage infrastructure
How you write itYAML playbooksHuman-readable configuration files
How it connectsSSH with existing OS credentials, no agentProviders that call each platform's API
Safe to re-runIdempotent: no change if already in the desired statePlan step shows what will change first
Free optionOpen source AnsibleHCP Terraform Free tier, up to 500 managed resources
Commercial editionRed Hat Ansible Automation PlatformIBM HCP Terraform and Terraform Enterprise

Terraform now carries IBM branding

Here's something many older comparisons won't tell you. HashiCorp's own plans page now presents the managed service as IBM HCP Terraform, with Essentials, Standard and Premium tiers, plus a self-managed IBM Terraform Enterprise and a Europe-hosted option. The free route is still there: HashiCorp says the HCP Terraform Free tier gives you up to 500 managed resources, unlimited users and apply cycles, and features such as SSO and policy as code.

How Terraform works

Terraform's docs describe a three-stage workflow. You write the resources you want, Terraform plans by showing what it will create, update or destroy, and on approval it applies the changes in the right order, respecting dependencies between resources. It manages low-level parts like compute, storage and networking as well as high-level ones like DNS entries, and thousands of providers on the Terraform Registry cover platforms from AWS, Azure and Google Cloud to GitHub and Kubernetes.

How Ansible works

Ansible's docs put its design down to a few principles. It's agentless, so you don't install extra software on every machine. Playbooks use plain YAML that reads like documentation. It connects over SSH with the credentials you already have, and it's idempotent, meaning that if a server already matches your playbook, running it again changes nothing. Red Hat sells the enterprise version, Ansible Automation Platform, which adds Event-Driven Ansible, an automation coding assistant and a product trial.

Ansible's docs also list continuous deployment of complex software and zero-downtime rolling updates among its common uses, which is why ops teams lean on it on release day. Because it's decentralized and uses the SSH access you already have, there's no central server you must keep running before you can apply a playbook, so a small team can start from one laptop.

Which tool for which task

  • Create a new cloud network, subnets and load balancer: Terraform.
  • Install and patch software on dozens of existing servers: Ansible.
  • Roll out an app update with no downtime: Ansible's rolling updates.
  • Keep DNS records and SaaS settings in version control: Terraform.
  • Rebuild a whole test environment from scratch: Terraform first, then Ansible.

For a wider view, read why some teams pick AWS as their cloud provider and my guide to hiring DevOps talent if nobody on your team owns automation yet.

My advice on Ansible or Terraform

If your pain is setting up cloud resources by hand, start with Terraform and its free tier, because the plan step shows you exactly what will change before anything does. If your pain is keeping existing servers configured and patched, start with Ansible, since there's nothing to install on the machines you manage. Once your environment grows, you'll likely want both, with Terraform owning the infrastructure and Ansible owning what runs on it.

Do you make infrastructure automation tools? Tool makers can ask to be considered for a featured place in comparisons like this one.

Work with me

Want AI doing the heavy lifting in your marketing?

I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.

Frequently asked questions

Can Ansible replace Terraform?

Not neatly. Ansible is built to configure systems and deploy software, while Terraform is built to provision infrastructure through provider APIs with a plan step. Many teams run both.

Is Terraform free?

HashiCorp offers an HCP Terraform Free tier with up to 500 managed resources and unlimited users. Paid tiers are now branded IBM HCP Terraform.

Does Ansible need an agent?

No. Ansible's docs describe an agentless design that connects over SSH with existing operating system credentials.

What language does Ansible use?

Ansible playbooks are written in YAML, which its docs say reads like documentation.

Can Terraform and Ansible work together?

Yes. A common pattern is Terraform creating the network and servers, then Ansible configuring the software on them. Terraform's docs focus on provisioning, and Ansible's focus on configuration and deployment.

Which is easier to learn?

Ansible's docs say its YAML playbooks read like documentation, which helps beginners. Terraform asks you to think in resources and providers, but its plan step makes changes easy to review.

Published and maintained by the Lilach Bullock team, covering marketing, AI and business growth.
Your buyers are asking AI who to use. Does it say you?

See for free whether ChatGPT, Claude, Perplexity, Gemini and Google name you, and get the plan to become the answer.

Check my AI visibility →
Sundays only

Get the Sunday newsletter.

One email a week. AI experiments, marketing tactics, and the workflows Lilach is building right now in her own business.

Subscribe free

Let’s get your marketing running on AI.

Book a free 30-minute call

We figure out what you need, where AI fits in, and what working together would look like.

Book the call →

Or take the 30-second calculator

You’ll see the hours and the money quietly leaking out of your week, and the three workflows worth building first.

Take the calculator →

Or grab the free AI resource library

Prompt packs, templates, checklists, and swipe files. The exact tools I build for paying clients. Yours, free.

Get the library →
Keep reading

More from the blog.