Ansible has many shortcomings, but until now there has not been an alternative that is simple to migrate to. Ansible alternatives such as Puppet, Salt and Chef are structurally different from Ansible, which is a barrier to migration: nobody ports an Ansible playbook to Puppet, they rewrite it against a different model of the world. Reemote is a Python configuration-management library that is very similar to Ansible. Reemote is so similar to Ansible that it is possible to migrate existing Ansible roles into Python.
What Ansible is bad at, and what Python gives back
Ansible's shortcomings mostly follow from one decision: configuration is written in a data-serialization format with a templating dialect bolted on, rather than in a programming language. Each cost has an ordinary Python answer:
- Complex logic is difficult to express in Jinja2. Interpolating a value into a config file is what the templating language is good at; filtering a host's interfaces to pick a listen address, merging per-environment defaults, or computing a package list from the target's release is not. That logic ends up as nested
{% set %}blocks and chains ofregex_search,ternaryanddefaultfilters that the next person cannot read. In Python it is just code —if, comprehensions, functions — written next to the deploy and reviewable on its own terms. - Your editor does not know your YAML. No go-to-definition on a task, no rename across usages, no check that a module argument is spelled correctly; a typo surfaces at runtime, on the target. Python gives you imports, a type checker, a linter and completion, so the same mistakes are caught before the deploy runs.
- Composition is a directory-layout convention. Roles include other roles by name, and variables flow through precedence rules that have to be remembered rather than read. Python composes with
importand function arguments: a reusable block of configuration is a function you can call with named arguments from another file. - The result is terminal output. What changed, on which host and why is printed for a human, so a program that needs to know parses stdout. A Reemote deploy returns the plan and the report as objects — changed flags, reasons, the exact commands sent — that you can assert on, log to a database, or gate a rollout on.
- Tests need a toolchain of their own. Molecule, testinfra and ansible-lint exist because a playbook cannot be imported and exercised directly the way a module can. A deploy is a generator, so the test opens by asserting on the requests it yields; the shipped role tests run a whole deploy twice against a simulated host, with no server involved.
None of these are arguments about whether Ansible works. It does, at scale, for years. They are the ceiling on how far the format can be pushed — and every one of them is a solved problem in the language most automation teams already use.
Ansible's core execution mechanisms
The costs above are all about how a deploy is written, composed and tested. What Ansible earns its adoption for is what happens when it runs — and those guarantees are the ones a migration cannot afford to lose.
Ansible's core execution mechanisms are:
Check mode. Ansible simulates the execution without actually making any changes, allowing you to validate configuration before deployment.
Lockstep execution. Ansible executes the same task on all target hosts and only proceeds to the next task after all hosts have completed the current task.
Reemote implements both lockstep execution and check mode. To run a deploy in check mode, add the dry-run flag:
plans, report, hosts = await run(inventory, deploy, dry=True) You get back a plan — the operations that would change something, per host, with the reason each one is marked changed — and nothing on any host is touched. Lockstep is not a mode you switch on; it is how the runner works. The apply phase advances one deploy generator per host in step, and each step has a barrier: no host moves on to the next operation until every host has finished the current one. Both of the mechanisms that make Ansible safe to run against production are therefore already there before you migrate a single task.
Try it in under a minute (docker connector)
Seeing both phases needs a target, and Reemote lets you pick a cheap one. It ships a docker connector that runs your deploy inside a local container, so you need neither a remote host nor an SSH key to see the two phases work. Docker or Podman must be installed locally — the connector shells out to whichever CLI you name in the inventory, and there is no default. Two steps:
# 1. Install (Python 3.13+; pip works just as well as uv) uv venv .venv && source .venv/bin/activate && uv pip install reemote # 2. Save the script below as hello.py, then run it python hello.py # hello.py import asyncio from reemote import files, format_log, format_plan, op, run INVENTORY = [{ "host": "demo", "family": "Alpine", "connection": { "connector": "docker", "identifier": "alpine:3.20", "docker_cmd": "podman", # or "docker" }, }] def deploy(host): yield op(files.install, name="Write a greeting", content="Hello from reemote!\n", dest="/tmp/reemote-hello.txt", mode="0644") async def main(): # Dry run: facts are gathered for real, nothing is mutated. plans, _, _ = await run(INVENTORY, deploy, dry=True) print("== Dry run: what would change ==") print(format_plan(plans)) # Apply: the same deploy, executed against a fresh container. _, report, _ = await run(INVENTORY, deploy) print("\n== Applied: what changed ==") assert report is not None print(format_log(report)) asyncio.run(main()) Reemote starts a throwaway alpine:3.20 container, previews the change without touching it, then runs the same deploy for real against a second container, prints the resulting command log, and finally commits each container into a new image and removes it. Verified output:
== Dry run: what would change == demo: Write a greeting [changed: content /tmp/reemote-hello.txt is absent, will install] == Applied: what changed == demo: Write a greeting [changed: content /tmp/reemote-hello.txt is absent, will install] $ scp <files install> -> /tmp/reemote-install-2e52d4f8373a608a/content $ sh -c 'mkdir -p /tmp && cp /tmp/reemote-install-2e52d4f8373a608a/content /tmp/reemote-hello.txt && chmod 644 /tmp/reemote-hello.txt && rm -rf /tmp/reemote-install-2e52d4f8373a608a' The dry-run line and the first line of the apply log are the same line — that is the point. The plan the dry-run showed you is the plan the apply executed, verbatim, with the shell commands appended. Each run(...) starts its own throwaway container from alpine:3.20, so both phases observe the same absent file; the demo is about the two-phase pattern, not idempotence.
The inventory is a plain Python list of host dictionaries carrying connection information. Reemote is agentless: for SSH targets the options in that block are forwarded to asyncssh's connect().
Deploys are generators, and the vocabulary is familiar
A deploy is a generator that yields operation requests in order — in the hello.py above, a single files.install. In general these operations map closely to their Ansible counterparts, so the vocabulary will be familiar.
The following deploy installs and starts nginx:
from reemote.modules import apt, files, systemd PAGE = "<!doctype html><h1>Hello from staging</h1>\n" def deploy(host): yield op(apt.packages, name="Install nginx", packages=("nginx",), sudo=True) yield op(files.install, name="Write landing page", content=PAGE, dest="/var/www/html/index.html", mode="0644", sudo=True) yield op(systemd.service, name="Run nginx", service="nginx", running=True, enabled=True, sudo=True) Read that against the Ansible tasks it corresponds to and the only differences are syntactic: a module becomes a function, a task name becomes a name= argument, become: true becomes sudo=True, and a list of tasks becomes a generator that yields them.
Point that deploy at your staging inventory with dry=True first and you get a per-host, per-operation diff of what staging is about to look like — the packages that will be installed, the file that will change, the service that will be started or left alone — before any of it happens. Read it, then run the same code without dry=True to apply.
Ansible offers a wide range of modules for package management and services. Reemote offers modules covering package management, files and version control, services, firewalls, system configuration, security, databases and containers — twenty-four of them, from apt, dnf and apk through files, git, systemd, firewalld, sysctl, selinux, mysql, postgresql and lxd.
Both the syntax and the semantics of Reemote operations are similar, and in many cases identical, to Ansible. Semantics matter more than syntax here: an operation reads the current state of the host, compares it against the state you described, and emits commands only when there is a real difference. That is why a second run of the nginx deploy above, against the same host, reports no change instead of reinstalling the package and restarting the service, and it is the same reason Ansible's tasks come out ok rather than changed.
The roles carry over too
Ansible Galaxy contains many battle-tested roles that can be incorporated into your deployment.
Reemote offers roles from Ansible Galaxy too. Reemote has incorporated many of Jeff Geerling's Ansible Galaxy roles and more roles are being added all the time — thirteen of his roles ship in the library today: Apache, Composer, Docker, Drush, Java, Memcached, NFS, nginx, NTP, PHP, PHP Xdebug, PostgreSQL and the EPEL repository role, alongside DataDog's official agent role. Each one is a Python module with typed role variables, not a directory of YAML loaded by convention, and each ships with a runnable example and an offline test that runs it twice against a simulated host and asserts the second pass reports zero changes.
That is the migration argument in one line. You are not converting your playbooks into someone else's model of configuration management; you are expressing the same tasks, modules, role variables, handlers and change reporting in Python — which means your existing roles become code you can import, type-check and test with pytest, and your team's Ansible knowledge stays current instead of obsolete.
- Documentation and full guide: https://reemote.org/
- Source: https://github.com/kimjarvis/reemote
- PyPI:
pip install reemote - License: EPL-2.0
