Fetch Time Out with Windows Server 2008 SP2 and R2 - Works for Server 2012

Hi,
Pretty new to Ansible, but enjoying it so far :slight_smile:

I have a playbook that connects to a Windows server, creates a zip file of a specific folder, sub folders and files, then upload to the Ansible server.

The zip file is 46,588,472 bytes

When the Windows server is Server 2012 it works correctly.
However, when the server is Server 2008 SP2 or Server 2008 R2 it uploads 42,467,328 bytes and times out every time.
The following error is raised on the Ansible server (RH 7):

Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py”, line 513, in fetch_file
result = self._winrm_exec(cmd_parts[0], cmd_parts[1:])
File “/usr/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py”, line 261, in _winrm_exec
command_id = self.protocol.run_command(self.shell_id, to_bytes(command), map(to_bytes, args), console_mode_stdin=(stdin_iterator is None))
File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 276, in run_command
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 184, 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 612, in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python2.7/site-packages/requests/adapters.py”, line 490, in send
raise ConnectionError(err, request=request)
ConnectionError: (‘Connection aborted.’, error(104, ‘Connection reset by peer’))

The Fetch command in the playbook is:

  • fetch:
    src=“S:/TEST/Data/TEST Automation Staging/test.co.uk-ansible-upload.zip”
    dest=“/test/ansible/playbooks/test/staging/”
    flat=yes
    become=false

Is there some sort of limit in WinRM of around 40Mb (or perhaps a time out if Server 2012 uploads slightly quicker) for Server 2008 SP2 and Server 2008 R2, that is raised/removed in Server 2012?

Any help gratefully appreciated.

Richie

Hmm, just wondering if you are hitting this

“On Windows 7 and Server 2008 R2 machines, due to a bug in Windows Management Framework 3.0, it may be necessary to install this hotfix http://support.microsoft.com/kb/2842230 to avoid receiving out of memory and stack overflow exceptions. Newly-installed Server 2008 R2 systems which are not fully up to date with windows updates are known to have this issue.”

from documentation here: http://docs.ansible.com/ansible/latest/intro_windows.html#windows-system-prep

I’m pretty certain there’s no file size limit as such.

Worth checking you have latest pywinrm installed as well - later versions are faster.

Actually I think there might be another possibility - although I’d expect a different error perhaps. Are you hitting the s2012 and s2008/r2 boxes at the same time? Since you are setting ‘flat=yes’ the effect of that will be to have fetch try and retrieve the file from multiple servers and write it to a single file, which probably isn’t desirable, and even if it were, you’d likely only get one file, or failures due to file locking. Try without ‘flat=yes’ if that’s the case.

Jon

Hi,
To further clarify on this, I have made some changes, including the following:

ansible_winrm_operation_timeout_sec=800
ansible_winrm_read_timeout_sec=900

Although not sure the above fixed the issue.
I can now connect to Server 2008 R2.
However, I still can’t connect to Server 2008 SP2 - it stops on any file over about 45Mb at precisely the same point on multiple Server 2008 SP2 servers. I can only conclude that you can’t use Fetch with them to upload files larger than this.

Richie

Further to your reply,
The servers do have that KB installed - one of the first things I checked.
The Ansible server has only recently been built, so would expect it to be up to date.
Testing has also only been with one server at a time.
Yes, also tried flat=‘no’ - obviously then saved file in subfolder, but still failed at exactly same point (41,472KB - is this size significant as I get it every time on all Server 2008 SP2 servers?)

Richie

I’m sorry I don’t have any S2008s to even try this out on.
A couple of things you could try though…

Not sure what python version you are using but perhaps try a newer 2.x revision if there’s one available for your controller.
Also you could try upgrading Windows Management Framework and the installed .net version on your s2008 machine.

Otherwise maybe try something like elastic filebeat for moving files around.
Hope this helps,

Jon