Hi Henning, this will not work due to the fact that "include_vars" is a
task, and roles are evaluated and loaded before any tasks are executed -
meaning the variable will not be available at that time. We could make your
given example work, however I don't think it's very useful this way, since
you'd have to specify the variable in vars, which doesn't buy you much.
Additionally, some users may try to use variables from inventory
(host/group vars) to do this, which would also not work and could cause
confusion.

On Thu, Jan 29, 2015 at 9:28 AM, Henning Eggers <henn...@keeeb.com> wrote:

> Hi!
>
> I stumbled onto the following.
>
> While this works:
>
> - hosts: all
>
>   roles:
>     - { role: foo, data: 'bar' }
>     - { role: foo, data: 'zab' }
>
>
> this will fail right away with "value of 'roles:' must be a list":
>
> - hosts: all
>   vars:
>     my_data:
>       - { role: foo, data: 'bar' }
>       - { role: foo, data: 'zab' }
>
>   roles: my_data
>
>
> So it makes a difference if the list of roles is provided verbatim or
> assigned to a variable first. This is especially surprising as this pattern
> works well with e.g. "with_items" where the list being looped can be either
> verbatim or a variable.
>
> Is this an intended limitation or a bug?
>
> Why do I need this? I want to load the variable from another file using
> "include_vars".
>
> Cheers,
> Henning
>
>  --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ba502beb-02b0-451e-bafc-668d28d88ced%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/ba502beb-02b0-451e-bafc-668d28d88ced%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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMFyvFg6%3Du%2BTSOVVCSTK29z6c3CWEUqZsynu8iKSzfzY84FteQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to