# Running on Windows

**URL:** <https://forum.ansible.com/t/running-on-windows/11930>\
**Category:** Ansible Project\
**Tags:** windows, ansible-project\
**Created:** [September 26, 2012, 10:24pm UTC](https://forum.ansible.com/t/running-on-windows/11930 "2012-09-26T22:24:08Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [November 21, 2012, 4:36pm UTC](https://forum.ansible.com/t/running-on-windows/11930/21 "2012-11-21T16:36:21Z")

</div>

It doesn't hurt to ask, but expect to receive at the mercy of the author +  
contributors.

Unless many windows admin contributors appear I don't see windows support  
in the near future. The majority of ansible users (and contributors) are  
running Linux, mostly RHEL and derivatives.

Support for other distros/platforms depends on demand among contributors,  
expertise, the ability to make patches that don't break other platforms and  
are able to meet with the approval of the original author.

The code is generally easy to expand for different platforms, with current  
efforts to make it even easier, but most platforms are unix like, windows  
is a big departure and might not be that easy to integrate.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [November 21, 2012, 4:40pm UTC](https://forum.ansible.com/t/running-on-windows/11930/22 "2012-11-21T16:40:24Z")

</div>

> Unless many windows admin contributors appear I don't see windows support in  
> the near future. The majority of ansible users (and contributors) are  
> running Linux, mostly RHEL and derivatives.

It may not be a majority, but it's a large group.

We have a pretty large amount of Debian/\*BSD folks now, and some  
amount of Solaris.

We definitely don't have many people managing OS X though.

---

<div class="post-metadata">

**Author:** ![Peder\_Jakobsen](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@Peder\_Jakobsen](https://forum.ansible.com/u/Peder_Jakobsen)\
**Post date:** [November 21, 2012, 4:42pm UTC](https://forum.ansible.com/t/running-on-windows/11930/23 "2012-11-21T16:42:40Z")

</div>

Let me clarify. I’m not interested in managing windows servers, I merely want to administer my remote \*nix servers from Cygwin or some other console.

If I can make it work, I’ll contribute a recipe.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 25, 2013, 12:47pm UTC](https://forum.ansible.com/t/running-on-windows/11930/24 "2013-01-25T12:47:57Z")

</div>

Hi,

This is nice.

My suggestion would be rather than creating the ansible-win, we try  
and get these changes encapsulated in utils and other functions, using  
try/except ImportError and so forth as neccessary.

This will prevent the need to dual maintain these in the future.

Can you make this happen? If so, that would be outstanding.

ansible and ansible-win do not look that different, in other words,  
and you've got most everything abstracted elsewhere.

Obviously we'd want ansible-playbook, and hopefully ansible-doc, too

Thanks!

--Michael

---

<div class="post-metadata">

**Author:** ![Giuliano\_Barberi](https://avatars.discourse-cdn.com/v4/letter/g/edb3f5/32.png) [@Giuliano\_Barberi](https://forum.ansible.com/u/Giuliano_Barberi)\
**Post date:** [January 25, 2013, 12:58pm UTC](https://forum.ansible.com/t/running-on-windows/11930/25 "2013-01-25T12:58:09Z")

</div>

That’s awesome I will try it later. We will probably need to create commands that play nice with ms install too

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 25, 2013, 1:14pm UTC](https://forum.ansible.com/t/running-on-windows/11930/26 "2013-01-25T13:14:22Z")

</div>

If you're talking about managing windows from ansible, that's another  
animal entirely, and would theoretically require something like a WMI  
transport type to maintain the 'no bootstrapping' philosophy.

I am not entirely convinced Windows admins really want this, or that  
various attempts of traditional Unix tools to fit in that space are  
accepted by Windows admin teams.

This is why we don't do it.

--Michael

---

<div class="post-metadata">

**Author:** ![Giuliano\_Barberi](https://avatars.discourse-cdn.com/v4/letter/g/edb3f5/32.png) [@Giuliano\_Barberi](https://forum.ansible.com/u/Giuliano_Barberi)\
**Post date:** [January 25, 2013, 1:29pm UTC](https://forum.ansible.com/t/running-on-windows/11930/27 "2013-01-25T13:29:20Z")

</div>

I have both windows and Linux servers. I love ansible and find the windows management environments overkill for most things. I would definitely like to use ansible to manage windows if possible.

---

<div class="post-metadata">

**Author:** ![Giuliano\_Barberi](https://avatars.discourse-cdn.com/v4/letter/g/edb3f5/32.png) [@Giuliano\_Barberi](https://forum.ansible.com/u/Giuliano_Barberi)\
**Post date:** [January 25, 2013, 2:32pm UTC](https://forum.ansible.com/t/running-on-windows/11930/28 "2013-01-25T14:32:20Z")

</div>

Sorry got confused though that this was running ansible from windows to manage linux not windows management 🙂

---

<div class="post-metadata">

**Author:** ![Shlomo\_Zippel](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shlomo\_Zippel](https://forum.ansible.com/u/Shlomo_Zippel)\
**Post date:** [January 25, 2013, 8:57pm UTC](https://forum.ansible.com/t/running-on-windows/11930/29 "2013-01-25T20:57:39Z")

</div>

> Hi,
> 
> This is nice.
> 
> My suggestion would be rather than creating the ansible-win, we try  
> and get these changes encapsulated in utils and other functions, using  
> try/except ImportError and so forth as neccessary.

Just to clarify: ansible-win.py is identical to ansible. I had to rename it  
for 2 reasons:  
- windows requires a .py extension, otherwise imp.find\_module will not find  
the script when forking (multiprocessing module does this)  
- if the script is renamed to ansible.py, attempting to import ansible from  
within the script causes the script itself to be imported (ansible.py)  
instead of the package (ansible/\_\_init.py\_\_)  
So I renamed it to ansible-win.py. This is obviously the wrong way to do  
it, I will try getting setup.py to rename the ansible script when  
installing in windows.

This will prevent the need to dual maintain these in the future.

> Can you make this happen? If so, that would be outstanding.
> 
> ansible and ansible-win do not look that different, in other words,  
> and you've got most everything abstracted elsewhere.
> 
> Obviously we'd want ansible-playbook, and hopefully ansible-doc, too

I will be looking at these later today. Hopefully I'll be running full  
playbooks from windows soon 🙂

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 25, 2013, 9:17pm UTC](https://forum.ansible.com/t/running-on-windows/11930/30 "2013-01-25T21:17:23Z")

</div>

ansible.bat or ansible.cmd as an additional file that invokes  
"python.exe ansible" should also work and avoid the rename.

There might be new nicer ways, but I haven't touched windows in about 10yrs

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 25, 2013, 10:47pm UTC](https://forum.ansible.com/t/running-on-windows/11930/31 "2013-01-25T22:47:23Z")

</div>

+1 to that.

like "python.exe ansible.cmd $\*"

Replacing "$\*" with whatever it is windows means all arguments given  
to the program in Windows, lest that be $1 $2 $3 $4 ... etc

it's been a while for me too 🙂

---

<div class="post-metadata">

**Author:** ![Shlomo\_Zippel](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shlomo\_Zippel](https://forum.ansible.com/u/Shlomo_Zippel)\
**Post date:** [January 26, 2013, 10:02pm UTC](https://forum.ansible.com/t/running-on-windows/11930/32 "2013-01-26T22:02:00Z")

</div>

Windows progress:

- removed the duplicate script- parallel exec working
- ansible-playbook & ansible-doc both working
- setup only installs windows specific scripts on windows

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 27, 2013, 2:12am UTC](https://forum.ansible.com/t/running-on-windows/11930/33 "2013-01-27T02:12:48Z")

</div>

This sounds great!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [March 5, 2013, 6:14pm UTC](https://forum.ansible.com/t/running-on-windows/11930/34 "2013-03-05T18:14:39Z")

</div>

> I've never really done much python reading, but this looks like the ssh  
> transport; looks like a class with 5 public methods (I assume a method  
> starting with \_ is not public...?), of which fetch\_file and put\_file of  
> which WinRM cannot readily support (I gather there are hoops to jump through  
> to get or put files to windows boxes - this guy explains it better than me,  
> search for "share"). That might be a reasonable thing to create a winrm.py  
> equivalent, or am I missing something fundamental?

I think there are probably going to be reasonable simple ways to ship  
Powershell to a remote box and execute them.

Trick is doing it nicely, in a way that does not require installing a  
Ruby (or other daemon) on the box -- and just using, say, the .NET  
framework.

--Michael

---

<div class="post-metadata">

**Author:** ![Peter\_Mounce](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@Peter\_Mounce](https://forum.ansible.com/u/Peter_Mounce)\
**Post date:** [March 5, 2013, 7:04pm UTC](https://forum.ansible.com/t/running-on-windows/11930/35 "2013-03-05T19:04:37Z")

</div>

That’s just it, though, without \*\*\*\*ing around with network shares, I don’t think there are ways to send scripts (as in, script files, which is how I read your reply) to the victim boxes to run.

However, to run just commands, one doesn’t need ruby etc on the box, just to have winrm active and listening, which one can do via [winrm quickconfig](http://msdn.microsoft.com/en-gb/library/windows/desktop/aa384372(v=vs.85).aspx) (in its most basic form) or active directory group policy so it happens when a server joins the AD (assuming there is one). winrm commands can then be anything; cmd invocations, powershell cmdlets, whatever - but from what I gather, that part is up to the ansible playbooks, which get written bespoke anyhow. (?)

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [March 5, 2013, 7:27pm UTC](https://forum.ansible.com/t/running-on-windows/11930/36 "2013-03-05T19:27:53Z")

</div>

I haven't done windows admin in a while, but if you are a admin on the  
target machine you used to have a share to C: (actually all drives).  
So it would be easy to copy scripts over netbios.

Another roundabout way is by setting a policy that downloads the  
scripts from a netlogon share.

---

<div class="post-metadata">

**Author:** ![Peter\_Mounce](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@Peter\_Mounce](https://forum.ansible.com/u/Peter_Mounce)\
**Post date:** [March 6, 2013, 8:15am UTC](https://forum.ansible.com/t/running-on-windows/11930/37 "2013-03-06T08:15:51Z")

</div>

Yes, the [administrative shares](https://en.wikipedia.org/wiki/Administrative_share) exist, but that requires that port 135 be open for netbios traffic. Opening netbios on public facing boxes involves living with some [security vulnerabilites](https://en.wikipedia.org/wiki/NetBIOS_over_TCP/IP#Security_vulnerabilities) (not least of which the fact that windows LAN manager _still_ doesn’t [store passwords securely](http://markgamache.blogspot.co.uk/2013/01/ntlm-challenge-response-is-100-broken.html)). WinRM requires either 5985 (default http) or 5986 (default https) to be open (or whatever non-default one might choose).

Powershell’s Invoke-Command cmdlet allows a script to exist locally, and be transformed into a scriptblock to run remotely on the list of victim computers, however: [https://blogs.technet.com/b/heyscriptingguy/archive/2012/07/25/an-introduction-to-powershell-remoting-part-three-interactive-and-fan-out-remoting.aspx](https://blogs.technet.com/b/heyscriptingguy/archive/2012/07/25/an-introduction-to-powershell-remoting-part-three-interactive-and-fan-out-remoting.aspx)

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [March 6, 2013, 11:27am UTC](https://forum.ansible.com/t/running-on-windows/11930/38 "2013-03-06T11:27:25Z")

</div>

Aside from restricting port access to specific IPs the only other  
thing I can think of to help you with this is installing an ssh server  
on windows. There is even a openssh version IIRC.

---

<div class="post-metadata">

**Author:** ![Peter\_Mounce](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@Peter\_Mounce](https://forum.ansible.com/u/Peter_Mounce)\
**Post date:** [March 6, 2013, 11:34am UTC](https://forum.ansible.com/t/running-on-windows/11930/39 "2013-03-06T11:34:29Z")

</div>

The issue with that is because I (currently) work in a Microsoft environment, some colleagues knee-jerk forbid non-MS methods for doing things when there is an MS-way. It’s … frustrating, but also difficult to circumvent.

---

<div class="post-metadata">

**Author:** ![Dave\_Cottlehuber](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Dave\_Cottlehuber](https://forum.ansible.com/u/Dave_Cottlehuber)\
**Post date:** [May 7, 2013, 11:44am UTC](https://forum.ansible.com/t/running-on-windows/11930/40 "2013-05-07T11:44:07Z")

</div>

Please post it, yes. And yes, devops on Windows is like trying to brush your teeth using a tiger’s tail.

[Previous page](https://forum.ansible.com/t/running-on-windows/11930.md?page=1)

[Next page](https://forum.ansible.com/t/running-on-windows/11930.md?page=3)
