I am trying to copy a bunch of files from server X (not control machine) to a group of servers, targets: Y1, Y2, ..., Yn (defined in host file)
files:
'-path
'- files
'- file1
'- file2
'- dir
'- file_x
My playbook:
#!/usr/bin/env ansible-playbook
---
vars:
src_dir: /path/files
hosts: {{ targets }}
tasks:
- name: copying files
command: "rsync -avrcz X:{{ src_dir }}/{{ artifacts }} {{ dest_dir }}"
My command line:
./playbook.yml -e '{"targets": "targets", "artifacts" : "{file1,file2,dir/file_x}", "dest_dir": "/yserv/dest/path"}'
This works and I am able to parallelize pretty decently, but I keep getting:
[WARNING]: Consider using synchronize module rather than running rsync
Is there a way to achieve this using synchronize module? Ansible doesn't seem to like bash brace expansion syntax. Passing file list as an array and using with_items is not practical since it makes the whole thing sequential by invoking rsync for every file and hence is very slow (there is a huge list of files to copy)
filesdownward? - Xiong Chiamiov