I wonder if this is still looking for the older name
ansible_ssh_user instead of ansible_user ?

You don't mention which version of ansible you are using.

I haven't checked but if it is older than current dev I think you will need 
to use the name 
ansible_ssh_user in your group vars 

same thing will apply for 

ansible_ssh_password
and 
ansible_ssh_port

even though winrm is not using ssh for the transport, the settings needed 
ssh in them for historical reasons.

Jon

On Sunday, November 1, 2015 at 9:22:53 PM UTC, Aleksander Sjåfjell wrote:
>
> Hi, Tianwei Liu. Did you find a solution for this problem? 
>
> I am experiencing the exact same result. I can run winrm-commands 
> directly, but Ansible gives me 401, access denied. If i run 
> ansible all -i windows.yml -m win_ping -vvvv
>
> Where windows.yml is as follows:
> [all]
> 192.168.50.4
>
> [all:vars]
> ansible_user="vagrant"
> ansible_password="vagrant"
> ansible_port="5985"
> ansible_connection="winrm"
>
> I get the following output:
>
> <192.168.50.4> ESTABLISH WINRM CONNECTION FOR USER: aas on PORT 5986 TO 
> 192.168.50.4
> <192.168.50.4> WINRM CONNECT: transport=plaintext endpoint=
> https://192.168.50.4:5986/wsman
> <192.168.50.4> WINRM CONNECTION ERROR: 401 Unauthorized.
>
> What i find a bit weird is that user is specified as 'aas' (my OSX user). 
> It seems that the username from inventory file is not used. All help 
> apprecieated.
>
> On Wednesday, October 21, 2015 at 6:48:13 PM UTC+2, 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/c041105d-9cf6-403c-bf40-795cd687413f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to