Connection to windows target host timeout

62 views
Skip to first unread message

MA

unread,
Jan 4, 2018, 10:19:27 AM1/4/18
to Ansible Project
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.

Jordan Borean

unread,
Jan 4, 2018, 5:12:59 PM1/4/18
to Ansible Project
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

MA

unread,
Jan 4, 2018, 5:24:45 PM1/4/18
to Ansible Project
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

Jordan Borean

unread,
Jan 4, 2018, 7:28:37 PM1/4/18
to Ansible Project
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
Reply all
Reply to author
Forward
Message has been deleted
0 new messages