Is there a way to iterate the fileglob with a list?
If I have 3 groups
"group1", "group2", "group3"
and each group is represented as a directory on the management host
/path/to/group1
and I want to look into each of those paths for *.cfg files
/path/to/group1/1.cfg
/path/to/group2/2.cfg
/path/to/group2/2_1.cfg
/path/to/group3/3.cfg
The way I understand the with_fileglob won't work?
Example
- name: my template
template:
src: "{{ item }}"
dest: "/tmp//{{ item | basename }}"
owner: root
group: root
mode: "0644"
with_fileglob:
- "{{ what_goes_here }}/*.cfg"
If the groups are dynamic and different for each host I cannot hard code the with_fileglob. I need to be able to replace the list to with_fileglob with /path/to/group1 and /path/to/group2 and /path/to/group3