# Ansible Windows

**URL:** <https://forum.ansible.com/t/ansible-windows/16538>\
**Category:** Ansible Project\
**Tags:** windows, ee\
**Created:** [October 17, 2014, 3:02pm UTC](https://forum.ansible.com/t/ansible-windows/16538 "2014-10-17T15:02:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan\_Cochrane](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@Bryan\_Cochrane](https://forum.ansible.com/u/Bryan_Cochrane)\
**Post date:** [October 17, 2014, 3:02pm UTC](https://forum.ansible.com/t/ansible-windows/16538/1 "2014-10-17T15:02:06Z")

</div>

I am trying to setup windows remoting for ansible.

I have Ansible version 1.7.2, ee-bryan is Windows 8.1, ee-csg is Windows Server 2012. Both have Powershell 4.

under /etc/ansible I have created hosts as  
[windows]  
ee-bryan  
ee-csg

and I have created /etc/ansible/group\_vars/windows.yml with

#It is suggested that these be encrypted with ansible-vault:

# ansible-vault edit group\_vars/windows.yml

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [October 19, 2014, 6:44pm UTC](https://forum.ansible.com/t/ansible-windows/16538/2 "2014-10-19T18:44:20Z")

</div>

Have you prepared your Windows nodes as per documentation? Basically, yuu need to enable WinRM connections over HTTPS, and enable Baisc auth for your WinRm endpoint. Look at the documentation, there’s a script that will do those things for you. I’ve uploaded a newer version of that script here: [https://gist.github.com/trondhindenes/2cd162d4b17c2c28ec40](https://gist.github.com/trondhindenes/2cd162d4b17c2c28ec40)

\_Trond

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 20, 2014, 8:58pm UTC](https://forum.ansible.com/t/ansible-windows/16538/3 "2014-10-20T20:58:14Z")

</div>

This is probably a good error to file upstream with winrm, such that on this error it can present something better to the user.

We could catch it, but an IndexError is the wrong sort of exception to be catching here.

---

<div class="post-metadata">

**Author:** ![Chris\_Church1](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Church1](https://forum.ansible.com/u/Chris_Church1)\
**Post date:** [October 25, 2014, 7:46pm UTC](https://forum.ansible.com/t/ansible-windows/16538/4 "2014-10-25T19:46:56Z")

</div>

That IndexError has been fixed in ansible devel. It's not really a pywinrm  
issue, but an ansible issue in trying to handle the HTTPError from pywinrm.

It happens when the HTTPError from urllib2 isn't a file-like object  
(despite what the docs say in  
[https://docs.python.org/2/library/urllib2.html#urllib2.HTTPError](https://docs.python.org/2/library/urllib2.html#urllib2.HTTPError)).

---

<div class="post-metadata">

**Author:** ![Peter\_Daly-Dickson1](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@Peter\_Daly-Dickson1](https://forum.ansible.com/u/Peter_Daly-Dickson1)\
**Post date:** [November 20, 2014, 3:56pm UTC](https://forum.ansible.com/t/ansible-windows/16538/5 "2014-11-20T15:56:45Z")

</div>

I get exactly the same…

**☿** |staging:e38026ddcaae ✗| → ansible -i ./provisioning/hosts windows -m win\_ping

54.67.74.52 | FAILED =\> Traceback (most recent call last):

File “/usr/local/lib/python2.7/site-packages/ansible-1.7.2-py2.7.egg/ansible/runner/ **init**.py”, line 561, in \_executor

exec\_rc = self.\_executor\_internal(host, new\_stdin)

File “/usr/local/lib/python2.7/site-packages/ansible-1.7.2-py2.7.egg/ansible/runner/ **init**.py”, line 666, in \_executor\_internal

return self.\_executor\_internal\_inner(host, self.module\_name, self.module\_args, inject, port, complex\_args=complex\_args)

File “/usr/local/lib/python2.7/site-packages/ansible-1.7.2-py2.7.egg/ansible/runner/ **init**.py”, line 837, in \_executor\_internal\_inner

conn = self.connector.connect(actual\_host, actual\_port, actual\_user, actual\_pass, actual\_transport, actual\_private\_key\_file)

File “/usr/local/lib/python2.7/site-packages/ansible-1.7.2-py2.7.egg/ansible/runner/connection.py”, line 34, in connect

self.active = conn.connect()

File “/usr/local/lib/python2.7/site-packages/ansible-1.7.2-py2.7.egg/ansible/runner/connection\_plugins/winrm.py”, line 132, in connect

self.protocol = self.\_winrm\_connect()

File “/usr/local/lib/python2.7/site-packages/ansible-1.7.2-py2.7.egg/ansible/runner/connection\_plugins/winrm.py”, line 90, in \_winrm\_connect

err\_msg = str(exc.args[0])

IndexError: tuple index out of range

I installed ansible on my Macbook Pro via homebrew. What’s the best/quickest/easiest way to get the fix for this?

Thanks.

P.

---

<div class="post-metadata">

**Author:** ![Peter\_Daly-Dickson1](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@Peter\_Daly-Dickson1](https://forum.ansible.com/u/Peter_Daly-Dickson1)\
**Post date:** [November 20, 2014, 4:08pm UTC](https://forum.ansible.com/t/ansible-windows/16538/6 "2014-11-20T16:08:53Z")

</div>

I installed ansible from source, and it now works a treat!

**☿** |staging:e38026ddcaae ✗| → ansible -i ./provisioning/hosts production -m win\_ping

54.67.74.52 | success \>\> {

“changed”: false,

“ping”: “pong”

}

Thanks for ansible, and for great resources to fix issues.

cheers

P.

---

<div class="post-metadata">

**Author:** ![Geoff\_Webster](https://avatars.discourse-cdn.com/v4/letter/g/f07891/32.png) [@Geoff\_Webster](https://forum.ansible.com/u/Geoff_Webster)\
**Post date:** [December 3, 2014, 7:06pm UTC](https://forum.ansible.com/t/ansible-windows/16538/7 "2014-12-03T19:06:04Z")

</div>

Are there plans on supporting the kerbros authentication so this works in domain environments?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [December 4, 2014, 8:07pm UTC](https://forum.ansible.com/t/ansible-windows/16538/8 "2014-12-04T20:07:50Z")

</div>

Yes, there is a thread on the Ansible Development list detailing progress on this.
