This is probably simple, but I’m not sure of the latest and greatest way to do it. In my playbook I have a var containing a list of filenames, and I copy them to a target directory on my nodes. I’d like to make sure those are the only files in that dir. I’d really rather not delete everything and re-copy every time, as it’s kinda wasteful, the files might be in use, the timestamps become meaningless, and you lose the idempotent thing. Is there an Ansible way to do this, or do I bust out the bashhammer and/or rsync?
Sync to a staging directory, remove the old ones, and generate links
to the files in the staging directory?
I'd consider calling rsync --delete via local_action/command.
(Note: I've suggested it seems to make sense to patch things to make
local_action assume "-c ssh" regardless of play settings)