Windows Support for Ansible stacks
The Spacelift maintained Ansible container that is used by default in Ansible stacks does not have the necessary python packages to support connecting to Windows servers, like pykerberos and pywinrm (there could be more, but these two are as far as I've dug on the subject at the moment). It would be a huge win to have support out-of-the-box for this
- Workaround
- Problem
Log in to comment and vote
Comments3
Jonah Kowall
Oct 6
Thanks for the detailed request, good point that connecting to Windows hosts is a well-supported, mainstream Ansible use case, not a fringe one.
First, the immediate unblock: you can do this today without waiting on us. The Spacelift Ansible stack supports fully custom runner images, so you can build an image based on our Ansible runner with pykerberos, pywinrm (and any other Windows-connection dependencies) pre-installed, then set it as your stack's custom runner image. You can also set an account-level default runner image so every Ansible stack picks it up automatically, that keeps it maintenance-light across your fleet as you migrate off AWX. If you'd rather not maintain an image, a before_init hook that pip-installs the packages at run time also works, though a prebuilt image is faster and more reproducible.
Separately, we're interested in whether an officially maintained Ansible-for-Windows runner image flavor would be worth providing out of the box. No promises, but to help us gauge that, it'd be great to understand:
- Which packages and connection plugins you rely on (pywinrm, pykerberos, and anything else? (e.g. are you going the WinRM or SSH-on-Windows route?)
- Roughly what share of your Ansible fleet targets Windows vs. Linux
- Whether maintaining your own image would be a genuine blocker to migrating, or just an inconvenience
Would the custom or default runner image approach unblock you in the meantime?
Cyan Spacelab
Nov 17
Hi Jonah - apologies for the delay in my response
The immediate unblock works - that was our plan forward for the time being, but I felt that since Ansible has a well-supported and well-documented Windows integration, that it should not require custom workarounds for a product that supports ansible.
I tried a before_init hook in my previous testing and it did not work because the installs required root level access and the container runs as the ‘spacelift’ user.
To answer your questions:
Before I had to pivot from testing, I got as far as pywinrm and pykerberos. WinRM is our connection protocol of choice for Windows servers as it is shipped on all Windows server by default vs Enabling OpenSSH for Windows as a feature on both legacy and new builds
I would say we have a rough 50/50 split between Windows and Linux. Potentially 40/60 Windows/Linux
It would just be an inconvenience, but as I stated - it’s odd that a product that sells itself with Ansible support and doesn’t encompass the full range of what Ansible natively supports
For some cases, a custom runner image makes sense - like adding pwsh (Powershell Core) to an Ansible container (which is a real use case for us), but if Ansible has built-in Windows support, and my orchestration layer supports Ansible, then the easy conclusion is that the Orchestration layer should support anything that Ansible supports.
Additionally - I will look into the default runner image, I did not know that you could target specific stack types with that option.
Jonah Kowall
Nov 17
Thanks CJ, and you're right on both counts. I need to correct two things I said earlier.
First,
before_initwon't get you Kerberos. The runner runs as thespaceliftuser, sopip install --user pywinrmworks but the krb5 system libraries need root. A custom image is the only workaround today.Second, I overstated the default runner image. It's set per repository through
stack_defaults.runner_imagein.spacelift/config.yml, not account-wide per stack type. If your Ansible playbooks live in a few repos, that still covers them with one line each.On the main point, I agree: Ansible supports Windows natively, so our runner should too. We already publish AWS, GCP and Azure flavors of the Ansible runner image, and a Windows flavor with pywinrm, Kerberos and pypsrp fits the same pattern. I'm taking that to the team and will update this post when it's scheduled. Your pwsh case is a good one for a custom image on top of it.