I have ported ansible to run under Windows, code available at https://github.com/zart/ansible/commits/native-windows-support
Port consists mostly in removing unconditional dependency on unix-only modules like pwd
, grp
, fcntl
, termios
.
Module library is mostly untouched.
Requirements to run it on Windows:
- python 2.x, obviously
- pywin32
- paramiko <=1.10.2, due to https://github.com/paramiko/paramiko/issues/193
- pyyaml and jinja2
- switch transport to paramiko
- disable colors
- you have to invoke
python bin\ansible
and the like to run extensionless scripts
I tested ansible, ansible-doc, ansible-playbook. Didn’t test ansible-pull yet. Basic stuff seems to work.
What doesn’t work:
-
running as proper binary/script
This requires either switch to setuptools (which are able to generate proper .exe/.pya stubs on windows) or renaming ansible scripts to *.py (which is not that pretty)
And renamingbin\ansible
tobin\ansible.py
is problematic sinceimport ansible
will import script itself instead of the package. -
colored output.
Right now it just appends some hard-coded ANSI sequences. Can be fixed by doing proper curses calls on Unix and using ctypes/win32console calls on Windows. -
ssh/ssh_alt transports
They’re using hard-codedssh -tt
command-line and lots of openssh-specific options. It either has to be reworked to allow other ssh implementations or new transport has to be written for alternative ssh implementations, like putty, ssh.com, etc. -
local transport (and local_action)
This defaults to /bin/sh. Should be possible to replace it with $SHELL/%COMSPEC% instead. sudo support can be implemented via runas
.
Still, most of the modules probably won’t work on Windows as-is.
- cows
Haven’t looked if there is a Windows port of cowsay ;D
This also opens opportunity to write custom wmi
transport (or module) for configuring windows boxes natively. Cross-platform support is still problematic.