How can I copy more than a single file into remote nodes by Ansible in a task?
I\'ve tried to duplicate the copy module line in my task to define files but it only copie
copy
module is a wrong tool for copying many files and/or directory structure, use synchronize
module instead which uses rsync
as backend. Mind you, it requires rsync
installed on both controller and target host. It's really powerful, check ansible documentation.
Example - copy files from build
directory (with subdirectories) of controller to /var/www/html
directory on target host:
synchronize:
src: ./my-static-web-page/build/
dest: /var/www/html
rsync_opts:
- "--chmod=D2755,F644" # copy from windows - force permissions