# Problems getting linux-controller for windows working

**URL:** <https://forum.ansible.com/t/problems-getting-linux-controller-for-windows-working/21149>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [April 13, 2016, 1:06pm UTC](https://forum.ansible.com/t/problems-getting-linux-controller-for-windows-working/21149 "2016-04-13T13:06:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Loehner](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@Benjamin\_Loehner](https://forum.ansible.com/u/Benjamin_Loehner)\
**Post date:** [April 13, 2016, 1:06pm UTC](https://forum.ansible.com/t/problems-getting-linux-controller-for-windows-working/21149/1 "2016-04-13T13:06:01Z")

</div>

Hi,

i followed the instructions at [http://docs.ansible.com/ansible/intro\_windows.html](http://docs.ansible.com/ansible/intro_windows.html) to set up a control machine but it won’t work. I the set up a second machine, following these instructions [http://darrylcauldwell.com/how-to-setup-an-ansible-test-lab-for-windows-managed-nodes-custom-windows-modules/](http://darrylcauldwell.com/how-to-setup-an-ansible-test-lab-for-windows-managed-nodes-custom-windows-modules/).

The funny thing is, both react the same way:

root@XX-WEB01:~# ansible all -m setup -vvv  
\<xxx.xxx.xxx.xxx\> ESTABLISH WINRM CONNECTION FOR USER: root on PORT 5986 TO xxx.xxx.xxx.xxx  
xxx.xxx.xxx.xxx | FAILED =\> Traceback (most recent call last):  
File “/usr/lib/python2.7/dist-packages/ansible/runner/ **init**.py”, line 561, in \_executor  
exec\_rc = self.\_executor\_internal(host, new\_stdin)  
File “/usr/lib/python2.7/dist-packages/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/lib/python2.7/dist-packages/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/lib/python2.7/dist-packages/ansible/runner/connection.py”, line 34, in connect  
self.active = conn.connect()  
File “/usr/lib/python2.7/dist-packages/ansible/runner/connection\_plugins/winrm.py”, line 132, in connect  
self.protocol = self.\_winrm\_connect()  
File “/usr/lib/python2.7/dist-packages/ansible/runner/connection\_plugins/winrm.py”, line 71, in \_winrm\_connect  
cache\_key = ‘%s:%s@%s:%d’ % (self.user, hashlib.md5(self.password).hexdigest(), self.host, port)  
TypeError: must be string or buffer, not None

Both machines are running Debian (3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86\_64 GNU/Linux), the target is a 2012R2. To be honest, i’m a linux newbie and i didn’t understand  
everything in the manuals.

---

<div class="post-metadata">

**Author:** ![Kevin\_Foster](https://avatars.discourse-cdn.com/v4/letter/k/ed655f/32.png) [@Kevin\_Foster](https://forum.ansible.com/u/Kevin_Foster)\
**Post date:** [April 20, 2016, 7:34pm UTC](https://forum.ansible.com/t/problems-getting-linux-controller-for-windows-working/21149/2 "2016-04-20T19:34:49Z")

</div>

It looks like it is trying user root to connect to your windows machine.

I use a local user to connect to my windows systems. I have a setup systems named veeam in my hosts file. I then setup /etc/ansible/group\_vars/veeam.yml. In this file I have:

ansible\_user: localuser  
ansible\_password: localuserspassword  
ansible\_port: 5986  
ansible\_connection: winrm  
ansible\_winrm\_server\_cert\_validation: ignore

Then I would run.  
ansible veeam -m setup -vvv

and it will automatically use the group\_vars/veeam.yml settings to access my veeam windows hosts.

You can see the example in the link you entered above: [http://docs.ansible.com/ansible/intro\_windows.html#inventory](http://docs.ansible.com/ansible/intro_windows.html#inventory) see the “In group\_vars…” section.

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [April 21, 2016, 10:41pm UTC](https://forum.ansible.com/t/problems-getting-linux-controller-for-windows-working/21149/3 "2016-04-21T22:41:55Z")

</div>

The traceback looks like you’re using Ansible 1.9 (or older)- the docs you reference are for 2.0+ (though have 1.9-specific stuff called out throughout). I’d guess you need to set ansible\_ssh\_user/ansible\_ssh\_pass in your inventory (where you’re probably using the 2.0 keys ansible\_user and ansible\_password).

---

<div class="post-metadata">

**Author:** ![Benjamin\_Loehner](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@Benjamin\_Loehner](https://forum.ansible.com/u/Benjamin_Loehner)\
**Post date:** [April 28, 2016, 10:33am UTC](https://forum.ansible.com/t/problems-getting-linux-controller-for-windows-working/21149/4 "2016-04-28T10:33:54Z")

</div>

Yes, you were right, thank you! I used apt-get and this installs an antique version of ansible. I solved that problem and just ran into the next wall.

\<srv-vm-2012r2.TEST.LOCAL\> ESTABLISH WINRM CONNECTION FOR USER: ansible@TEST.LOCAL on PORT 5986 TO srv-vm-2012r2.TEST.LOCAL  
srv-vm-2012r2.TEST.LOCAL | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “kerberos: ‘ascii’ codec can’t decode byte 0xc3 in position 12: ordinal not in range(128), ssl: ‘ascii’ codec can’t decode byte 0xc3 in position 12: ordinal not in range(128)”,  
“unreachable”: true  
}

Sorry to bother you again, but as i said i’m a newbie and nothing works as shown in the how-tos, pretty frustrating.

---

<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:** [April 28, 2016, 11:41am UTC](https://forum.ansible.com/t/problems-getting-linux-controller-for-windows-working/21149/5 "2016-04-28T11:41:14Z")

</div>

Hey,

Do you have an activity directory domain called ‘TEST.LOCAL’ or are you attempting to connect as a local user called ansible (which has been created in the users and groups panel on the target windows box)?

I think if you are trying to use a local user, drop the @TEST.LOCAL bit from your username.

Also did you run the ConfigureRemotingForAnsible.ps1 script on the target windows box?

Not seen that specific error before - I wonder if you have a non-ascii character in your configuration vars somewhere. If the above doesn’t help I’d suggest using od -cx on your inventory / group\_vars to see if there are any characters outside ascii range.

Hope this helps.

Jon

---

<div class="post-metadata">

**Author:** ![Benjamin\_Loehner](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@Benjamin\_Loehner](https://forum.ansible.com/u/Benjamin_Loehner)\
**Post date:** [April 28, 2016, 12:27pm UTC](https://forum.ansible.com/t/problems-getting-linux-controller-for-windows-working/21149/6 "2016-04-28T12:27:27Z")

</div>

Hi Jon,

i actually have a domain called test.local with a user called ansible. I did it, like it was described in [Link 1](http://docs.ansible.com/ansible/intro_windows.html) and [Link 2](http://hindenes.com/trondsworking/2015/07/27/ansible-and-windows-configuring-kerberosactive-directory-authentication/).  
Yes, i ran the script, but it only says powershell 3.0 is already installed.

My hosts-file looks like this:

[windows]  
srv-vm-2012r2.TEST.LOCAL

[windows:vars]  
ansible\_user = ansible@TEST.LOCAL  
ansible\_connection = winrm  
ansible\_port = 5986

And this is my krb5.conf:

[libdefaults]  
default\_realm = TEST.LOCAL

[realms]  
TEST.LOCAL = {  
kdc = srv-vm-2012r2.test.local  
default\_domain = test.local  
kpasswd\_server = srv-vm-2012r2.test.local  
}  
[domain\_realm]  
.test.local = TEST.LOCAL

If i do a kinit, it accepts my pass and returns this on klist:

root@BL-Ansible:~/ansible/hacking# klist  
Ticket cache: FILE:/tmp/krb5cc\_0  
Default principal: ansible@TEST.LOCAL

Valid starting Expires Service principal  
28.04.2016 11:32:37 28.04.2016 21:32:37 krbtgt/TEST.LOCAL@TEST.LOCAL  
renew until 29.04.2016 11:32:34  
28.04.2016 11:41:36 28.04.2016 21:32:37 HTTP/srv-vm-2012r2.test.local@TEST.LOCAL  
renew until 29.04.2016 11:32:34

But there appeared something (red text) new:

root@BL-Ansible:~/ansible/hacking# ansible windows -m setup -vvv  
No config file found; using defaults  
\<srv-vm-2012r2.TEST.LOCAL\> ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5986 TO srv-vm-2012r2.TEST.LOCAL  
srv-vm-2012r2.TEST.LOCAL | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “ssl: ‘ascii’ codec can’t decode byte 0xc3 in position 12: ordinal not in range(128)”,  
“unreachable”: true  
}

And what do you mean with "-cx on your inventory / group\_vars "? Always remember, i’m a linux n00b 🙂

---

<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:** [April 28, 2016, 4:43pm UTC](https://forum.ansible.com/t/problems-getting-linux-controller-for-windows-working/21149/7 "2016-04-28T16:43:30Z")

</div>

The new bit is probably because you aren’t running from a folder where there’s an ansible.cfg file  
if you cd to /etc/ansible (or wherever you keep your ansible.cfg) then that will go away.

My guess would be you aren’t picking up the python-kerberos library

If you run python and then enter the following

import kerberos

do you get

‘ImportError: No module named kerberos’

If so you need to install the python-kerberos lib, probably like this

```auto
pip install kerberos

```

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![Bluesky1](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@Bluesky1](https://forum.ansible.com/u/Bluesky1)\
**Post date:** [July 13, 2017, 2:47am UTC](https://forum.ansible.com/t/problems-getting-linux-controller-for-windows-working/21149/8 "2017-07-13T02:47:05Z")

</div>

Is there a solution to this problem? Must reduce the version of ansible?

在 2016年4月13日星期三 UTC+8下午9:06:01，Benjamin Loehner写道：
