Skip to main content

Ansible vs Chef vs Puppet (2026)

Choose the right configuration management tool for your infrastructure. Compare Ansible, Chef, and Puppet across architecture, learning curve, scalability, and ecosystem — with real examples.

✓ Feature comparison table ✓ Example playbook & recipe ✓ When to choose each ✓ vs Terraform

Feature Comparison

Feature Ansible Chef Puppet
ArchitectureAgentless, pushAgent + server, pullAgent + server, pull
LanguageYAMLRuby DSLPuppet DSL
Learning curveLowHighMedium
IdempotencyModule-dependentStrongStrong
Scale (nodes)100s–1000s10,000s10,000s
Windows supportGood (WinRM)GoodGood
Community modules5,000+ Galaxy4,000+ Supermarket6,000+ Forge
Testing frameworkMoleculeTest Kitchen + InSpecPuppet RSpec / Litmus
Commercial supportRed Hat AnsibleProgress ChefPerforce Puppet

Ansible — Example Playbook

# playbooks/nginx.yml — Install and configure Nginx
---
- name: Configure web servers
  hosts: webservers
  become: true
  vars:
    nginx_port: 443
    server_name: app.example.com

  tasks:
    - name: Install Nginx
      ansible.builtin.package:
        name: nginx
        state: present

    - name: Configure Nginx
      ansible.builtin.template:
        src: templates/nginx.conf.j2
        dest: /etc/nginx/nginx.conf
        owner: root
        group: root
        mode: '0644'
      notify: Restart Nginx

    - name: Open firewall port
      ansible.posix.firewalld:
        port: "{{ nginx_port }}/tcp"
        permanent: true
        state: enabled

    - name: Ensure Nginx is running
      ansible.builtin.service:
        name: nginx
        state: started
        enabled: true

  handlers:
    - name: Restart Nginx
      ansible.builtin.service:
        name: nginx
        state: restarted

Chef — Example Recipe

# cookbooks/webserver/recipes/default.rb
package 'nginx' do
  action :install
end

template '/etc/nginx/nginx.conf' do
  source 'nginx.conf.erb'
  owner 'root'
  group 'root'
  mode '0644'
  variables(
    port: node['webserver']['port'],
    server_name: node['webserver']['server_name']
  )
  notifies :restart, 'service[nginx]', :delayed
end

firewalld_port "{node['webserver']['port']}/tcp" do
  action :add
  zone 'public'
  permanent true
end

service 'nginx' do
  action [:enable, :start]
end

Puppet — Example Manifest

# modules/webserver/manifests/init.pp
class webserver (
  Integer $port        = 443,
  String  $server_name = 'app.example.com',
) {
  package { 'nginx':
    ensure => installed,
  }

  file { '/etc/nginx/nginx.conf':
    ensure  => file,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => epp('webserver/nginx.conf.epp', {
      'port'        => $port,
      'server_name' => $server_name,
    }),
    require => Package['nginx'],
    notify  => Service['nginx'],
  }

  service { 'nginx':
    ensure  => running,
    enable  => true,
    require => Package['nginx'],
  }
}

When to Choose Each Tool

Frequently Asked Questions

What is the main difference between Ansible, Chef, and Puppet?▼

The core difference is architecture and philosophy. Ansible is agentless and push-based — it connects over SSH and runs tasks imperatively, making it easy to start with. It's great for ad-hoc automation and simple configuration management. Chef and Puppet are agent-based and pull-based — agents on each node check in with a central server and apply the desired state. Chef uses Ruby DSL and thinks in 'recipes' and 'cookbooks'; Puppet uses its own declarative language (Puppet DSL) and a catalog-based model. Ansible wins on simplicity; Chef/Puppet win on scale and idempotency guarantees for large fleets.

Should I use Ansible or Terraform for infrastructure management?▼

They solve different problems. Terraform manages infrastructure state — it creates, modifies, and destroys cloud resources like VMs, networks, and databases. It's declarative and tracks state in a .tfstate file. Ansible configures what's already running — it installs packages, writes config files, manages services, and deploys applications. Use them together: Terraform provisions the infrastructure, Ansible configures it. Don't use Ansible to create cloud resources (it can, but state tracking is weak). Don't use Terraform to manage application configuration inside VMs (it's not designed for that).

Is Ansible still relevant in a Kubernetes-first world?▼

Yes, for several use cases. Kubernetes manages containerized workloads, but you still need to configure the nodes themselves, bootstrap the cluster, manage secrets, configure monitoring agents, and handle non-containerized legacy systems. Ansible is also widely used for network device configuration (routers, switches via Ansible Network), Windows configuration management, and simple deployment pipelines where Kubernetes is overkill. Many teams use Ansible for the 'layer below' Kubernetes — OS hardening, node configuration, and the initial cluster bootstrap. Ansible is also the simplest path for small teams without Kubernetes expertise.

What is the learning curve for each tool?▼

Ansible is the easiest to learn — YAML syntax, no agents, and you can write your first working playbook in an hour. It has the largest community and most modules. Chef has the steepest learning curve — Ruby DSL requires Ruby knowledge, and the Chef ecosystem (workstations, Chef Server, Berkshelf, Test Kitchen) has many moving parts. Puppet is in between — the Puppet DSL is custom and declarative, which some find intuitive and others find frustrating. Puppet also has PuppetDB, Hiera, and Puppet Server to manage. For teams without a dedicated DevOps person, Ansible is strongly preferred. For large enterprises with dedicated infrastructure engineers, Puppet or Chef provide stronger guarantees.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →