Ansible has a copy module that copies files from the local box to the remote ones and a fetch module that copies files from remote machines to the local one. Is there a core module that copies from a remote to the same remote without reverting to shell commands?
The Copy module takes a file from the local (control) machine and sends it to a target. The Fetch module takes a file from the target and pull it to the local machine.
Using the modules in combination will ‘delegate_to’ will not help you either, since that will perform the action against the delegated target instead.
In your scenario I would use the ‘command’ module though in conjunction with the ‘creates’ option like:
27 декември 2014, събота, 03:21:06 UTC-5, Nico K. написа:
Hi Rambius,
The Copy module takes a file from the local (control) machine and sends it to a target. The Fetch module takes a file from the target and pull it to the local machine.
Using the modules in combination will ‘delegate_to’ will not help you either, since that will perform the action against the delegated target instead.
In your scenario I would use the ‘command’ module though in conjunction with the ‘creates’ option like:
I think I did a feature request for this. A ‘command’ or ‘shell’ works just fine if you just want to copy, but if you want to set ownership / permissions / SELinix context / etc. then it starts to get messy, and a module would be a nice solution.