Sansible
ansible-core that also runs natively on Windows. No WSL, no Cygwin, no fork of Ansible's
code: pip install sansible gives you the real, unmodified ansible-core, plus a small layer
that is loaded automatically at import time and removes ansible-core's POSIX-only assumptions.
pip install sansible
sansible doctor # checks the installation
ansible-playbook -i inventory.ini site.yml
All the usual commands work: ansible-playbook, ansible, ansible-galaxy,
ansible-vault, ansible-inventory, ansible-doc, and so on. They are ansible-core's own.
Every collection works too.
| Controller | What Sansible changes |
|---|---|
| Windows | Everything below is active automatically. |
| Linux / macOS | Nothing, unless you opt in: by default this is plain ansible-core. SANSIBLE_WORKER=pool enables the spawn-based worker pool, and SANSIBLE_SSH=paramiko routes ssh to the pure-Python plugin. |
What it does
ansible-core's controller assumes a POSIX host. Sansible removes those assumptions without changing a line of ansible-core on disk:
- Spawn-based worker pool instead of
fork(). ansible-core forks one process per host per task; Windows has nofork(). Sansible runs tasks in a persistent pool of spawned worker processes. Each task's inputs are pickled when ansible-core would have forked, and the controller state fork used to carry implicitly is rebuilt explicitly. The result is verified identical to fork, using ansible-core's own integration tests. - Pure-Python SSH. The builtin
sshplugin needs OpenSSH ControlPersist, ptys and POSIX file descriptors. On Windows,ansible_connection=sshis routed tosansible.core.paramiko, based on ansible-core's own paramiko plugin (removed upstream in 2026). Inventory variables such asansible_user,ansible_port,ansible_ssh_private_key_fileandansible_passwordwork as usual. - Windows-local execution.
connection: local, implicitlocalhostanddelegate_to: localhostrun throughsansible.core.winlocal, which uses PowerShell, soansible.windows.*modules can manage the controller itself. - Portable stand-ins for
fcntl,termios,pty,pwd,grpand libcwcwidth. - A dozen exact-text patches, applied at import time, for places where ansible-core
assumes
/path separators or POSIX permission bits. If ansible-core ever changes one of those lines, the import fails loudly instead of running unpatched code.
Supported setups
| From a Windows controller to… | Connection | Status |
|---|---|---|
| Windows hosts | psrp / winrm |
✅ tested (PSRP, including Kerberos/NTLM with your logon credentials) |
| Linux / Unix hosts | ssh (paramiko) |
✅ tested |
| Windows hosts over SSH | ssh + ansible_shell_type=powershell |
✅ tested |
| The Windows controller itself | local / implicit localhost |
✅ PowerShell modules (ansible.windows.*) and controller-side actions |
Limitations on a Windows controller
- Python modules (
ansible.builtin.copy,command, …) can't run on the Windows controller itself; use theansible.windowsequivalents for localhost tasks. They work as usual on POSIX targets. becomeon the local connection isn't supported. Run Ansible from an elevated prompt instead.- Network appliances that need
ansible.netcommonpersistent connections are untested. - Windows paths and backslashes: ansible's INI inventory format and
-e key=valueextra vars both treat\as an escape character (C:\tempturns into a tab). Use forward slashes (C:/keys/id_ed25519), YAML inventories, or JSON extra vars (-e '{"dir": "C:\\temp"}').
Versions
A Sansible version is the ansible-core version it ships and was tested with, plus a
revision. For example, 2.22.0.1 is ansible-core 2.22.0, Sansible revision 1.
- ansible-core is pinned exactly. The import-time patches are verified against that release only.
- New ansible-core releases are tracked automatically. Every day a GitHub Actions job checks PyPI. When a new ansible-core is out, it runs the full test matrix (Linux, macOS and Windows; Python 3.13 and 3.14; real SSH and PSRP targets; ansible-core's own integration tests under the spawn pool). If everything passes, it publishes the matching Sansible release. If anything fails, it opens an issue and publishes nothing.
- Python 3.13 or newer is required, the same as ansible-core 2.22.
Checking an installation
$ sansible doctor
sansible 2.22.0.1
ansible-core 2.22.0 (built for 2.22.0)
worker model pool
source patches 12 checked (12 active here), all apply
connection ssh -> sansible.core.paramiko
connection local -> sansible.core.winlocal
...
OK
| Environment variable | Effect |
|---|---|
SANSIBLE_WORKER=pool / fork |
Worker model. Default: fork where available, pool on Windows. |
SANSIBLE_SSH=paramiko |
Use the pure-Python SSH plugin on Linux/macOS too. |
SANSIBLE_DISABLE=1 |
Don't load the compatibility layer (Linux/macOS only; Windows needs it). |
SANSIBLE_DEBUG_LOG=path |
Log worker starts and crashes. |
Development
Before pushing, run both gates. CI should only confirm what they have already shown:
scripts/check.sh # lint, build, workflow checks, tests on 3.13 + 3.14, integration targets
scripts/test-windows.sh user@windows-host # same suite on a real Windows machine over SSH (needs uv there)
Tests run against the installed wheel, through the real ansible CLI. Remote-target tests are
driven by environment variables (SANSIBLE_TEST_SSH_*, SANSIBLE_TEST_PSRP_*); CI sets
them up with real OpenSSH and WinRM services. tests/winsim simulates a Windows controller
on Linux (no fork, no POSIX-only modules) for fast iteration.
Releasing a Sansible revision by hand: bump __version__ in src/sansible/__init__.py
(for example 2.22.0.1 to 2.22.0.2), merge, then push the tag v2.22.0.2. The release
workflow tests and publishes it.
Background
Sansible started as a small, from-scratch Ansible-compatible runner. That engine is preserved
on the legacy-0.4 branch, and
pip install sansible==0.4.1 still installs it. Research into running the real ansible-core
on Windows showed that the gap is small and well-defined, so Sansible now ships ansible-core
itself. The research, measurements and findings are in
experiments/ansible-core-windows. The goal is to
upstream these changes to ansible-core, so that eventually this package is no longer needed.
License
GPL-3.0-or-later, the same as ansible-core. Releases 0.4.x and earlier were MIT.
Metadata
Release files for sansible 2.22.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sansible-2.22.0.1.tar.gz | 60.1 kB | With provenance | Details for sansible-2.22.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sansible-2.22.0.1-py3-none-any.whl | Python 3 | none | any | Details for sansible-2.22.0.1-py3-none-any.whl |
Total release size: 107.5 kB
Release files / sansible-2.22.0.1.tar.gz
| Download URL | sansible-2.22.0.1.tar.gz |
|---|---|
| Size | 60.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cc996fe5db8845b2fce4b98f11339a526253e5dafbf62f8d9169d8cce4479a1
|
|
BLAKE2b-256 checksum How to use checksums |
cfecf679d2a35cae88ffb30891444bc97369d18883e3adb1a3da6bf189c2f22e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / sansible-2.22.0.1-py3-none-any.whl
| Download URL | sansible-2.22.0.1-py3-none-any.whl |
|---|---|
| Size | 47.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12db3cb86ed9c49f80330833c612ce8d856b571d1c2cc56b77ebf6991cd67f41
|
|
BLAKE2b-256 checksum How to use checksums |
d15ed5fbf09fbfb32dc899ba87f9f6f1dba062b095b30d5dfbe5533503d1173d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logSecurity for sansible 2.22.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sansible-2.22.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.