In the above, app1 and app2 are not hashes, but lists of strings.
I think you would want to define them like:
app2: { base: "foo" }
etc
But really probably
apps:
- { name: app1, base: foo }
- { name: app2, base: bar }
tasks:
- blarg: ...
with_items: apps
Etc.
Let me know if you'd like more detail on some of the above, but that should
get you started.
On Fri, Jul 18, 2014 at 2:58 PM, Brandon Metcalf <
[email protected]> wrote:
> It seems this should work according to the docs. It does work if I use
>
> with_items: app1
>
>
> $ cat jj.yml
> ---
> - hosts: all
>
> vars:
> app1:
> - base: "{{ file | basename }}"
>
> app2:
> - base: "{{ file }}"
>
> tasks:
> - name: debug
> debug: msg="{{ item.base }}"
> with_items:
> - app1
> - app2
>
> $ ansible-playbook ./jj.yml -i hosts --extra-vars 'file=/tmp/jj'
> ...
> TASK: [debug]
> *****************************************************************
> fatal: [myhost] => One or more undefined variables: 'str' object has no
> attribute 'base'
>
> What am I doing wrong? Thanks.
>
> --
> 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/CABdN8i05KDF%2BdO0y%2B8ZApsixbqdCfrtrRjf9vwxeZ0hJ87Ueeg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CABdN8i05KDF%2BdO0y%2B8ZApsixbqdCfrtrRjf9vwxeZ0hJ87Ueeg%40mail.gmail.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%2BnsWgzVuztjXN8_sE0W%3DUFrpOQ7b2nwjQKsWQacRa0cR%3DAO5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.