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
/path/to/group2
/path/to/group3

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
/path/to/group3/3_1.cfg
/path/to/group3/3_2.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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3e041e5b-f42b-4c77-a7e3-fcb0e378c6d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to