Question:
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 copies the first file.
Answer:
You can use the with_fileglob
loop for this:
1 2 3 4 5 6 7 8 |
- copy: src: "{{ item }}" dest: /etc/fooapp/ owner: root mode: 600 with_fileglob: - /playbooks/files/fooapp/* |