basic connection to windows with WinRM failing, need a clue.

First time trying to get some windows automation going, I must be missing something. Installed winrm & powershell via the ansible provided scripts from: http://docs.ansible.com/ansible/latest/intro_windows.html#windows-system-prep

attempting basic auth only, this is ansible 2.5.0 (latest)

this works just fine:
curl -vk -d “” -u “tmp:scout” http://10.80.180.41:5985/wsman

`

  • Trying 10.80.180.41…

  • Connected to 10.80.180.41 (10.80.180.41) port 5985 (#0)

  • Server auth using Basic with user ‘tmp’

POST /wsman HTTP/1.1

Host: 10.80.180.41:5985

Authorization: Basic dG1wOjRzY291dA==

User-Agent: curl/7.43.0

Accept: /

Content-Length: 0

Content-Type: application/x-www-form-urlencoded

< HTTP/1.1 401

< Server: Microsoft-HTTPAPI/2.0

< WWW-Authenticate: Negotiate

< Date: Thu, 16 Nov 2017 22:53:09 GMT

< Connection: close

< Content-Length: 0

<

  • Closing connection 0Enter code here…

`

Using same everything with ansible:

group_vars/windows.yml

ansible_user: tmp ansible_password: scout ansible_ssh_port: 5985 ansible_connection: winrm ansible_winrm_scheme: http ansible_winrm_server_cert_validation: ignore ansible_winrm_transport: plaintext

This fails:
ansible windows -i hosts -m win_ping

`

10.80.180.41 | UNREACHABLE! => {

“changed”: false,

“msg”: “plaintext: the specified credentials were rejected by the server”,

“unreachable”: true

}

`

Credentials are fine as you can see and I have logged in with them, set as “Administrator”.

Any ideas?

thanks!

Your curl command is returning a 401 Unauthorized. That is not successful.

Good catch.

The root issue here is http, must be https or the windows trustedhost rules come into play.

I got it to work with https and a self-signed cert.

Is the user you are attempting to connect with a Local admin? if not try winrm configSDDL default then adding the required permissions for the user.