← All insightsComparison

Ansible vs Pulumi: which should you choose?

Nir Geier, CodeWizard · 15 June 2025 · 3 min read · Intermediate

Ansible and Pulumi solve overlapping problems, and teams often have to pick one. Here is an honest comparison of what each does well and how to choose.

Ansible

Ansible configures servers and orchestrates deploys using idempotent 'playbooks' - YAML that describes desired state and runs over SSH with no agent to install on the targets.

yaml
- hosts: web
  become: true
  tasks:
    - name: Install nginx
      ansible.builtin.package:
        name: nginx
        state: present
    - name: Ensure nginx is running and enabled
      ansible.builtin.service:
        name: nginx
        state: started
        enabled: true
    - name: Deploy site config
      ansible.builtin.template:
        src: site.conf.j2
        dest: /etc/nginx/conf.d/site.conf
      notify: reload nginx
  handlers:
    - name: reload nginx
      ansible.builtin.service: { name: nginx, state: reloaded }

Pulumi

Pulumi lets you define cloud infrastructure using general-purpose languages (TypeScript, Python, Go, C#), bringing loops, functions, tests and IDE support to IaC while keeping a Terraform-like plan/apply model.

typescript
import * as aws from "@pulumi/aws";

const assets = new aws.s3.BucketV2("assets", {
  bucket: "acme-assets",
  tags: { Environment: "prod" },
});

export const bucketName = assets.bucket;

How to choose

  • Choose Ansible if: agentless: it only needs ssh and python on the target
  • Choose Pulumi if: use real languages with loops, functions and unit tests
  • Prefer the option your team can operate and debug confidently
  • Match the tool to your scale today, with a clear path for tomorrow
The best tool is the one your team will actually operate well - not the one with the longest feature list.

Not sure which fits your stack? CodeWizard's senior engineers use both Ansible and Pulumi in production and can give you a straight answer for your context.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult