DEV Community

Kim Jarvis
Kim Jarvis

Posted on Originally published at reemote.hashnode.dev

Converting Ansible to Python

Ansible has well-known shortcomings, yet teams have lacked a direct migration path away from it. Alternatives like Puppet, Salt, and Chef use structurally different models, creating a high barrier to conversion. Rather than porting an Ansible playbook, engineers typically rewrite it from scratch against a different paradigm—often at considerable cost.

Converting Ansible workflows to Python offers more than familiarity with a widely used DevOps language. Tools like Pulumi already bring infrastructure provisioning into Python, and a native Python configuration management library complements that stack. Ideally, teams can provision and configure infrastructure in the same language.

Reemote is a pure Python configuration management library designed to bridge that gap. It supports Ansible-style check mode, simulating execution without applying changes so you can validate configurations before deployment. It also preserves Ansible's lockstep execution model: it runs each task across all target hosts and advances to the next task only after every host finishes the current one.

Because Reemote closely mirrors Ansible's mental model, converting an Ansible role into a Python program is straightforward—supported by a dedicated AI skill for the translation. The Reemote repository includes more than 40 examples of Ansible Galaxy roles converted to Python, including many of Jeff Geerling's canonical roles.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

The lockstep detail is the one that stood out to me — keeping Ansible's run-each-task-across-every-host model instead of switching to a different execution style means teams do not have to relearn how a run behaves, which is usually the hidden cost of a migration. The 40-plus converted Galaxy roles make the claim concrete too.

One thing I am curious about: with lockstep execution, what happens when one host fails a task — does the whole run stop for every host, or does it mark that host and keep going with the rest?