Fixing an Ansible Synchronize Module and OpenWRT Failure

I have an Ansible playbook that calls the synchronize module (which uses one of my favourite tools, rsync) to send a copy of a git repository to an OpenWRT router. Yes, you can use Ansible with OpenWRT. In this case:

synchronize: src=/tmp/owrt_git_repo dest=/root/bin

This drew an error:

failed: [owrt ->] => {"cmd": "rsync --delay-updates -F --compress --archive --rsh 'ssh -S none -o StrictHostKeyChecking=no' --out-format='<<CHANGED>>%i %n%L' \"/tmp/owrt_git_repo/\" \"root@owrt:/root/bin\"", "failed": true, "rc": 12}
msg: rsync: This rsync lacks old-style --compress due to its external zlib.  Try -zz.
rsync error: syntax or usage error (code 1) at main.c(1554) [server=3.1.1]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]

So I searched for "compress" in the ansible file list: grep compress $(dpkg -L ansible | grep sync) (the Ansible master is a Debian machine). All results pointed to /usr/lib/python2.7/dist-packages/ansible/modules/core/files/ I edited that and looked for occurrences of "compress". There are several, but only one "--compress", which I changed to "-zz" ... and problem solved. I should probably submit a patch, but to do that I'd have to understand the other occurrences of "compress" in the file (and possibly a lot more) and make sure they were still correct. In the end I sent an email to Timothy Appnel, whose email is at the top of the source.

UPDATE: I've since applied this fix on another machine ... and it still throws the same error, despite the fact that the "cmd" is showing "-zz" instead of "--compress" - so this clearly isn't a complete fix.

UPDATE 2: I've heard back from Timothy Appnel:

Thanks for your message and apologies for it taking me so long to
reply. You caught me right as I was transitioning into my new roles at
Ansible and your message got buried. I used my access to the core
engineers to run your message by them for input for additional input.
To track the issue I created a ticket here:

It's a tricky problem in that the use of -zz and --compress are version
dependent. Most rsync releases "in the wild" do not support -zz. There
is a workaround in your case without hacking code -- turn off the
compress feature in the synchronize module with compress=no and pass
-zz using the rsync_opts.

Hope that helps and thanks for pointing this out.

So ... not so easy. But at least I seem to have pointed out an unknown bug. Wish I could have supplied a working patch ...