Connection to windows target host timeout

I’m trying to win_ping a windows host to verify a connection but I keep getting the timeout error bellow:

windows1 | UNREACHABLE! => {
“changed”: false,
“msg”: “plaintext: HTTPConnectionPool(host=‘xx.xx.xx.xx’, port=3128): Read timed out. (read timeout=30)”,
“unreachable”: true
}

I can establish a connection via telnet from the control machine to the target host but when I run win_ping it times out.

Any help is greatly appreciated.

Have you set up the WinRM listener with a custom port, usually it is over 5985 or 5986 (HTTPS) but the message is saying you are connecting over 3128.

Thanks

Jordan

Hi, I haven’t. what’s been shown in the message is my proxy, I didn’t quite understand why its being shown as an error though.

Regards

MA

If you are trying to connect through a proxy I would set the WinRM host settings based on the host itself and then define the proxy vars as environment variables, e.g.

inventory.ini

`
ansible_host=xx.xx.xx.xx
ansible_user=username
ansible_password=password
ansible_port=5986
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore

`

When running Ansible make sure you have defined the following environment variables

export HTTPS_PROXY=https://proxyhost:3128 ansible-playbook -i inventory.ini main.yml

Unfortunately there is no way to programatically define the proxy for an individual host in Ansible as pywinrm does not expose those parameters.

Thanks

Jordan