OK. That helps get my head straighter.
I was trying to develop this so that users had the options of using the module directly giving them additional (lower level) control of how Ansible uses rsync without having to deal with a raw command action. That was the intent. I need to dig thru the archives when we were discussing it on the list.
As for how the synchronize action works – its meant to be as simple and straight forward as possible (as opposed to a command action to rsync) by applying a lot of magic behind the scenes. In its most basic form:
synchronize: src=some/relative/path dest=/some/absolute/path
This will sychronize the path defined by dest on the inventory_hostname in context with the path defined by src on the localhost (by default – pass a delegate_to and that is used instead). By adding mode=pull you can reverse the sychronization.
synchronize: src=some/relative/path dest=/some/absolute/path mode=pull
As usual facts and variables are resolved so you could synchronize some path on multiple hosts to local subdirectories by hostname and the like. Relative paths are supported
The action detects being run using the local transport and takes appropriate action.
Two bonus features:
Provding a delete=yes argument will delete any files in the dest not found in the src using the --delete-after option in rsync. The default is to not delete files.
Providing a verbosity=1 argument turns on lots of information getting returned to Ansible. Increment verbosity to 2 you get even more information from processing. Take that to 3 and you get the firehose of information back from rsync. Good for lowel-level debugging if that helps you. The default is 0 (quiet).
The action always uses the archive mode, transfers with compression and delays updates until the end of the transfer to avoid leaving any hosts in some potentially broken, in-between state.
Some additional magic – the action gets the runner’s private key file for accessing the remote server and it uses ansible’s temporary files path in syncing. Also, if you work for a company like me that can’t do anything normal, you can specify an alternate location for rsync using a host facts, ansible_rsync_path.
Now to rework this in to the module documentation YAML and then do some testing.