This is already fixed on devel and we're looking at releasing 1.7 in a
couple of weeks.

https://github.com/ansible/ansible/commit/6e814566de36558a52bcb19ab4231e572cf5a63b


On Mon, Jul 28, 2014 at 11:55 PM, Nico K. <[email protected]> wrote:

> Hi Michael,
>
> It's funny you say that, since I've been running this playbook for a while
> and ever since the update it started failing; it might very well be that
> the 'when' never did what I expected it to do though.
>
> However, there is a clear change in behavior, further investigation shows
> that previously:
>
> roles/x/tasks/main.yml:
> - include: ../../y/tasks/main.yml name="sometask"
>
> roles/y/tasks/main.yml
> - include: "{{ name }}.yml"
>
> would evaluate to "sometask.yml", however now it evaluates to
> "sometask".yml (Mind the quoting)
> When you remove the quotes around variable passed in (name=sometask) it
> does seem to work again.
>
> -N.
>
> Op maandag 28 juli 2014 16:04:55 UTC+2 schreef Michael DeHaan:
>
>> So this still works and we know because we have an integration test for
>> it, but what you have with the "when: file is defined" has NEVER worked.
>>
>> What happens with an include is the conditional is applied to all tasks
>> in the include, it *cannot* be used to decide to include something or not,
>> because the same tasks (with different variable contexts of course) get
>> applied to all hosts.
>>
>>
>>
>>
>> On Sun, Jul 27, 2014 at 5:08 PM, Nico K. <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I just updated to the latest and greatest revision and since the update
>>> I can no longer perform an include of a file defined through a variable.
>>>
>>> For instance:
>>>
>>> - include: "{{ file }}.yml"
>>>   when: file is defined
>>>
>>> now throws the following error:
>>>
>>> ERROR: file could not read: /path/to/file/"file".yml
>>>
>>> (note the double quotes that are added around 'file').
>>>
>>> -Nico.
>>>
>>> --
>>> 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/cb5b1d34-7f80-4377-8206-
>>> e6d5be088c19%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/cb5b1d34-7f80-4377-8206-e6d5be088c19%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> 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/e96c7de2-105c-42f9-b77b-cf3e1734ee15%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/e96c7de2-105c-42f9-b77b-cf3e1734ee15%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgzyjU0H6Kfoe9TH1n7%2BSyBkasHwi_FHzRQ8VNpQ0W1Ohg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to