So basically now simple includes without any loops or variables in file 
name will be static by default? That is great news, since most of the 
includes are like that and it makes them at least backward compatible with 
1.x.

Could anyone tell me what exactly is the difference between:

- include: "{{ some_var }}.yml"
  static: yes


and

- include: "{{ some_var }}.yml"
  static: no

Does it mean for static: yes that some_var would need to be defined 
statically as a var, and for static: no some_var could be defined during 
play execution, e.g. set_fact: some_var=something.

On Tuesday, March 15, 2016 at 3:44:57 PM UTC+1, James Cammarata wrote:
>
> On Tue, Mar 15, 2016 at 10:19 AM, James Cammarata <[email protected] 
> <javascript:>> wrote:
>
>> On Tue, Mar 15, 2016 at 10:12 AM, Jan Grant <[email protected] 
>> <javascript:>> wrote:
>>
>>> I certainly don't want to see dynamic includes go away.
>>>
>>
>> They're definitely not going to go away :)
>>  
>>
>> Assuming the preprocessing and running code is neatly split, how about:
>>>
>>> 1. Preprocess "static" includes - which can be identified by the absence 
>>> of J2 constructs in them
>>> 2. Dynamically preprocess dynamic includes and run them as currently.
>>> 3. Add a "dynamic: yes" flag which optionally adds the dynamic behaviour 
>>> for things that look like static includes.
>>>
>>
>> #1 is something which can be done pretty easily, if there's no loop and 
>> the file name contains no variables. For #3 though, I went the other way 
>> because to me the more tricky thing to figure out is when you see something 
>> like my earlier example, when you've got `- include: "{{some_var}}.yml"`, 
>> and you want to force it to be pre-processed instead of dynamic. This is 
>> why I picked the `static: yes` syntax instead of the converse. 
>>
>> I can look at tweaking my feature branch to do the above, though this is 
>> why I added config options. Using variables in the include name is valid in 
>> 1.x, so to 2.0 those would look like dynamic includes (as they should, 
>> because now the variable COULD come from an inventory source as well).
>>
>
> Just pushed an update to my feature branch to implement #1 above:
>
>
> https://github.com/ansible/ansible/compare/static_includes#diff-69130db4f6e9ef75876cab5ca756d9d6R118
>
>

-- 
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/38d81bb7-188c-4f64-960f-22bb8f30ef6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to