That's what I needed, thanks!!

On Monday, February 29, 2016 at 10:22:49 PM UTC-7, Brian Coca wrote:
>
> first, don't put anything under group_vars/host_vars that you want to 
> selectively load, these files will load automatically if matched. Using 
> include_vars against group/host_vars is not recommended.
>
> 2nd the easiest way is putting them in a vars/ folder adjacent to play (or 
> in role) and use include_vars:
>
> - include_vars: "{{item}}.yml"
>   with_items: "{{apps}}" 
>
> if what you want it to load both files with last one overriding previous 
> ones when the same vars are in multiple files.
>
> On Mon, Feb 29, 2016 at 6:47 PM, Chris <[email protected] 
> <javascript:>> wrote:
>
>> I'm not seeing a clear way on how to do this in the docs, and maybe there 
>> is some other way to go about it. Basically I want to load up data about 
>> multiple applications to use in a template. I tried using include_vars, but 
>> I'm not seeing how to dynamically load that. I currently have this 
>> structure:
>>
>> groups_vars/staging_apps.yml:
>> ---
>> apps: ['app1','app2']
>>
>> I want to then load these files by using the app names from above:
>> groups_vars/apps/app1.yml
>> groups_vars/apps/app2.yml
>>
>> Those files would have additional variables that define each app.
>>
>> In the task I was thinking something along the lines of:
>>
>> ---
>>   - include_vars: group_vars/staging.yml
>>
>>   - name: Print apps
>>     debug: msg="App {{ apps }}"
>>
>>   - include_vars:
>> .. etc
>>
>> Any help is appreciated.
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/e1eb9e2b-82ba-4bf3-8f1a-a3a235fe371e%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/e1eb9e2b-82ba-4bf3-8f1a-a3a235fe371e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> ----------
> Brian Coca
>

-- 
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/a52fe8e8-8465-4472-a060-d22377a74f90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to