Thanks, Michael. I was able to get something like that working. However, what I ultimately need is the ability to control the order in which app1 and app2 are operated on within certain tasks. For some tasks, I need to operate on app1 first and for others app2 first.
On Sat, Jul 19, 2014 at 7:00 AM, Michael DeHaan <[email protected]> wrote: > 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 > <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzVuztjXN8_sE0W%3DUFrpOQ7b2nwjQKsWQacRa0cR%3DAO5w%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Brandon Metcalf | Technical Operations [email protected] M: 1-512-917-8198 <http://www.logicmonitor.com> *Cloud-based performance monitoring* * <https://www.facebook.com/LogicMonitor?ID=70140000000mSeh> <https://twitter.com/logicmonitor?ID=70140000000mSem> <https://www.linkedin.com/company/1165219?ID=70140000000mSer>* -- 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/CABdN8i0di2K9q8Sa5SRjnKU2MEQp_hctUEVPxRx6bKUXdADNYg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
