WinRM timeout for VMWare Tools Install

I’ve got a basic task to install VMWare tools on a Windows VM and when it installs it looks to cause a temporary network disconnection whilst it updates the NIC drivers. During this time WinRM looks to be timing out and throwing an error. VMWare tools is successfully installing though. Is anyone else using Ansible to install VMWare tools on Windows?

Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/plugins/connection/winrm.py”, line 270, in exec_command
result = self._winrm_exec(cmd_parts[0], cmd_parts[1:], from_exec=True)
File “/usr/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/plugins/connection/winrm.py”, line 215, in _winrm_exec
response = Response(self.protocol.get_command_output(self.shell_id, command_id))
File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 333, in get_command_output
self._raw_get_command_output(shell_id, command_id)
File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 352, in _raw_get_command_output
res = self.send_message(xmltodict.unparse(req))
File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 207, in send_message
return self.transport.send_message(message)
File “/usr/lib/python2.7/site-packages/winrm/transport.py”, line 173, in send_message
response = self.session.send(prepared_request, timeout=self.read_timeout_sec)
File “/usr/lib/python2.7/site-packages/requests/sessions.py”, line 585, in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python2.7/site-packages/requests/adapters.py”, line 479, in send
raise ReadTimeout(e, request=request)
ReadTimeout: HTTPSConnectionPool(host=‘LABSTC2WINVT675.labs.corp’, port=5986): Read timed out. (read timeout=30)
fatal: [LABSTC2WINVT675.labs.corp]: UNREACHABLE! => {“changed”: false, “msg”: “failed to exec cmd PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand UwBlAHQALQBTAHQAcgBpAGMAdABNAG8AZABlACAALQBWAGUAcgBzAGkAbwBuACAATABhAHQAZQBzAHQACgBUAHIAeQAKAHsACgAmACAAJwBDADoAXABVAHMAZQByAHMAXABhAF8AdQBzAGUAcgBcAEEAcABwAEQAYQB0AGEAXABMAG8AYw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AGUAcgByAG8AcgBfAHIAZQBjAG8AcgBkACcALAAgACgAJABfACAAfAAgAEMAbwBuAHYAZQByAHQAVABvAC0ASgBzAG8AbgAgAHwAIABDAG8AbgB2AGUAcgB0AEYAcgBvAG0ALQBKAHMAbwBuACkAKQAKAH0ACgBDAGEAdABjAGgACgB7AAoAfQAKAEUAYwBoAG8AIAAkAF8AbwBiAGoAIAB8ACAAQwBvAG4AdgBlAHIAdABUAG8ALQBKAHMAbwBuACAALQBDAG8AbQBwAHIAZQBzAHMAIAAtAEQAZQBwAHQAaAAgADkAOQAKAEUAeABpAHQAIAAxAAoAfQAKAEYAaQBuAGEAbABsAHkAIAB7ACAAUgBlAG0AbwB2AGUALQBJAHQAZQBtACAAIgBDADoAXABVAHMAZQByAHMAXABhAF8AdQBzAGUAcgBcAEEAcABwAEQAYQB0AGEAXABMAG8AYwBhAGwAXABUAGUAbQBwAFwAYQBuAHMAaQBiAGwAZQAtAHQAbQBwAC0AMQA0ADYAOQA4ADMAMwA1ADQANAAuADAAMQAtADIANgA0ADEANAA4ADEAOQAwADQAOAAzADIAOAAiACAALQBGAG8AcgBjAGUAIAAtAFIAZQBjAHUAcgBzAGUAIAAtAEUAcgByAG8AcgBBAGMAdABpAG8AbgAgAFMAaQBsAGUAbgB0AGwAeQBDAG8AbgB0AGkAbgB1AGUAIAB9AA==”, “unreachable”: true}

Not doing this but interested to do so.

Not quite the same but see this - https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1018377

I think if you can persuade it not to restart networking immediately, then you can use the win_reboot: action to restart after the vmware tools installation has run through.

Lets us know how you get on, I’m sure there are others who would be interested in this.

Jon

Ansible 2.2 is scheduled to ship with async support for Windows (I’m putting the finishing touches on it now), which would be the right solution to this if you’re unable to otherwise defer the NIC bounce.

-Matt

Unfortunately the only switches I could find with VMWare tools was to exclude modules entirely, not to postpone a delayed install until reboot. I’m just going to keep VMware tools on my templates along with the Windows Update until the async feature becomes available for Windows.

Regards,

Matt

Did someone find a solutions for the time-out?

The psrp connection plugin in Ansible 2.8 adds a reconnection_retries and reconnection_backoff option that allows you to retry a connection x amount of times on a ReadTimeout https://docs.ansible.com/ansible/devel/plugins/connection/psrp.html. You could try that out and see how it goes.

The docs jhawkesworth linked to showed you that it is possible possible to delay the reboot, you should be doing that then running win_reboot after installing the tools so Ansible handles the reboot for you.

Thanks

Jordan