MA1
(MA)
January 4, 2018, 3:19pm
1
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.
jborean
(Jordan Borean)
January 4, 2018, 10:12pm
2
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
MA1
(MA)
January 4, 2018, 10:24pm
3
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
jborean
(Jordan Borean)
January 5, 2018, 12:28am
4
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