I’m using an Ansible playbook to copy files between my host and a server. The thing is, I have to run the script repeatedly in order to upload some updates. At the beginning I was using the “copy” module of Ansible, but to improve performance of the synchronizing of files and directories, I’ve now switched to use the “synchronize” module. That way I can ensure Ansible uses rsync instead of sftp or scp.
With the “copy” module, I was able to specify the file’s mode in the destination host by adding the mode option (e.g.
mode=644). I want to do that using synchronize, but it only has the
perms option that accepts yes or no as values.
Is there a way to specify the file’s mode using “synchronize”, without having to inherit it?
Finally I solved it using
- name: sync file