Config for Windows host

I’m trying to use Ansible for a Windows host. I followed the instructions, but I’m getting an error when I try to run anything simple:
ansible inventory -m setup or ansible inventory -m wing_ping

Host IP| UNREACHABLE! => {
“changed”: false,
“msg”: “ssl: HTTPSConnectionPool(host=‘Host IP’, port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError(‘<urllib3.connection.VerifiedHTTPSConnection object at 0xbc8550>: Failed to establish a new connection: [Errno 111] Connection refused’,))”,
“unreachable”: true
}

This is just a workgroup so local accounts. Any ideas? Thanks

‘Connection refused’ usually means you have established a connection to the machine, but its not happy with your attempt to log in.

I suggest you run ansible with -vvvvv which will give you a bit more debug information and check that the user you are connecting with is the one you expect.

Also worth checking the event log on the windows box to see if there’s any information about why the connection was refused.

Double check you’ve run all the setup instructions (including running the configure for remoting script on the remote windows machine).

If you are still stuck, connect to the windows box and run the following as administrator

winrm get winrm/config

Also if the machine is running S2008R2 make sure the WMF 3.0 hotfix http://support.microsoft.com/kb/2842230 has been installed - its documented in the blue Notes box at the bottom of this section of the windows documentation page: http://docs.ansible.com/ansible/intro_windows.html#windows-system-prep

Please let us know how you get on.

Jon

Thanks for the tips. I was just missing this line in my hosts:

ansible_winrm_server_cert_validation=ignore

Thankfully a simple fix.