Which ansible version are you using?  (run 'ansible --version' to find out).

Generally 401 means the expected password doesn't match the one you 
supplied.

You could check the event log on the windows machine for more information.

Also, did you 
run 
https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
 
?



On Wednesday, October 21, 2015 at 5:48:13 PM UTC+1, Tianwei Liu wrote:
>
> Hi,
>
> I am having this weird problem that my ansible will always show 401 error 
> when trying to connect my windows machine via winrm. Although I can use 
> pywinrm with no problem at all authenticating with the exact same account 
> and password.
>
> My inventory:
> [windows]
> 192.168.2.3
>
> [windows:vars]
> ansible_ssh_user=ansible
> ansible_ssh_password=ansible
> ansible_ssh_port=5986
> ansible_connection=winrm
>
> I can run the example from: https://github.com/diyan/pywinrm and get 
> results with no problem but my ansible ping results in 401.
>
> $ ansible windows -i inventory.yml -m win_ping -vvvv
>
> <192.168.2.3> ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5986 TO 
> 192.168.2.3
>
> <192.168.2.3> WINRM CONNECT: transport=plaintext endpoint=
> https://192.168.2.3:5986/wsman
>
> <192.168.2.3> WINRM CONNECTION ERROR: 401 Unauthorized.
>
> 192.168.2.3 | FAILED => 401 Unauthorized. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/326eb4e2-223a-441b-984c-01a9cc31dd37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to