# Issue when trying to ping a windows host using Ansible

**URL:** <https://forum.ansible.com/t/issue-when-trying-to-ping-a-windows-host-using-ansible/23948>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [March 13, 2017, 8:47am UTC](https://forum.ansible.com/t/issue-when-trying-to-ping-a-windows-host-using-ansible/23948 "2017-03-13T08:47:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alstar\_Films](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@Alstar\_Films](https://forum.ansible.com/u/Alstar_Films)\
**Post date:** [March 13, 2017, 8:47am UTC](https://forum.ansible.com/t/issue-when-trying-to-ping-a-windows-host-using-ansible/23948/1 "2017-03-13T08:47:22Z")

</div>

Hi Guys,

This is literally my first day using Ansible and I am trying to connect to one of my windows 2012 host and using win\_ping. I have a control server using Centos. I encountered a number of issues before I got to this point but now when I run **ansible windows -i host.yml -m win\_ping** the error I get is **ERROR! Unexpected Exception: dictionary update sequence element #0 has length 1; 2 is required**

No idea where to look i even did a -vvvv and it says the same thing. Below are my 2 yml files

**host.yml**

[windows]

10.109.140.64

**windows.yml**

ansible\_ssh\_user:admin

ansible\_ssh\_pass:XXXXX

ansible\_ssh\_port:5985

ansible\_connection:winrm

ansible\_winrm\_cert\_validation:ignore

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 13, 2017, 4:50pm UTC](https://forum.ansible.com/t/issue-when-trying-to-ping-a-windows-host-using-ansible/23948/2 "2017-03-13T16:50:39Z")

</div>

> host.yml
> 
> [windows]
> 
> 10.109.140.64

that is not a yaml file, and the other one seems to be missing a space  
after each :

---

<div class="post-metadata">

**Author:** ![Alstar\_Films](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@Alstar\_Films](https://forum.ansible.com/u/Alstar_Films)\
**Post date:** [March 13, 2017, 5:59pm UTC](https://forum.ansible.com/t/issue-when-trying-to-ping-a-windows-host-using-ansible/23948/3 "2017-03-13T17:59:03Z")

</div>

Hi Brian,

If i dont give a space after : in the windows.yml file then i get this error ““ **msg": “plaintext: the specified credentials were rejected by the server”** ,” (Looks like a space is taken as a character entry” and thats why I removed the space after :

Now i am getting the error " **ERROR! Unexpected Exception: dictionary update sequence element #0 has length 1; 2 is required"**

Also what do u you mean when you say the the first one is not a yaml file?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 13, 2017, 6:20pm UTC](https://forum.ansible.com/t/issue-when-trying-to-ping-a-windows-host-using-ansible/23948/4 "2017-03-13T18:20:18Z")

</div>

its not yaml format, also if you dont have a space after : its also  
incorrect yaml.

---

<div class="post-metadata">

**Author:** ![Alstar\_Films](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@Alstar\_Films](https://forum.ansible.com/u/Alstar_Films)\
**Post date:** [March 13, 2017, 6:31pm UTC](https://forum.ansible.com/t/issue-when-trying-to-ping-a-windows-host-using-ansible/23948/5 "2017-03-13T18:31:43Z")

</div>

Hi,

Can you tell me what format should I be using so that I can correct the file?

---

<div class="post-metadata">

**Author:** ![cupcake](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@cupcake](https://forum.ansible.com/u/cupcake)\
**Post date:** [March 15, 2017, 10:43pm UTC](https://forum.ansible.com/t/issue-when-trying-to-ping-a-windows-host-using-ansible/23948/6 "2017-03-15T22:43:41Z")

</div>

I feel like with inventory files ive had better luck using = sign

Also the default winrm setting likely has basic auth set to false. if you run with -vvvvv it should should winrm debug and can see the auth type

---

<div class="post-metadata">

**Author:** ![cupcake](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@cupcake](https://forum.ansible.com/u/cupcake)\
**Post date:** [March 16, 2017, 1:12am UTC](https://forum.ansible.com/t/issue-when-trying-to-ping-a-windows-host-using-ansible/23948/7 "2017-03-16T01:12:25Z")

</div>

IF you are connecting and NOT spec’ing a connect type I believe it goes kerberos first, then plaintext/basic.

you would need to check if basic is enabled via powershell (run powershell as admin to be safe)

`  
winrm get winrm/config/service/auth

`

and it will return something like;

`

Auth  
Basic = false  
Kerberos = true  
Negotiate = true  
Certificate = false  
CredSSP = false  
CbtHardeningLevel = Relaxed

`

In order to make basic/plaintext function do this

`

PS C:\Windows\system32\> winrm set winrm/config/service/auth ‘@{Basic=“true”}’  
Auth  
Basic = true  
Kerberos = true  
Negotiate = true  
Certificate = false  
CredSSP = false  
CbtHardeningLevel = Relaxed

`

So basic = plaintext meaning you are sending your credentials in the clear. for testing this is probably OK, but realize that if you are going http port 5985 anyone can get the password pretty darn easy with a packet capture. I don’t believe setting transport to ssl does anything in basic mode either.

Getting kerberos setup is more ideal for the long run, plus you wont have to create or embed some local account on all your machines.
