On Thursday, 6 December 2018 07:17:06 CET [email protected] wrote:
> 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

The easiest is to create a variable like config_path, and set that to different 
value for each group.
Then you can use that variable one in the with_fileglob.

-- 
Kai Stian Olstad


-- 
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/6727556.pEx7RId79D%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to