On 12/10/2013 03:17 PM, Michael Baydoun wrote:
I'm doing something like this

  tasks:

- lineinfile: dest={{ item[0] }}/.gitignore create=yes regexp='{{ item[1] }}' line='*.{{ item[1] }}'

      with_nested:

        - [ '/tmp/foo', '/tmp/bar' ]

        - [ 'lck', 'log', 'Log' ]


but then I want to do other operations on the same list of directories (item[0]).

the vars section will only take key/value pairs, not arrays.

Can I group with_nested so it's specified once but apply to multiple modules?

Or pre build an array that will work with_items or with_nested?

--
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].
For more options, visit https://groups.google.com/groups/opt_out.

I'm confused about where the problem is. Your syntax is fine and the example works, but what prevents you from using the same with_nested loop on other tasks?

Are you looking for a quicker way to reference those items than having to type out the lists over and over again?

The regex items seems like a finite list, which could become a global var. The filenames seem more dynamic so I would probably not permanently store them if they are registered results of other tasks.

Maybe we could offer more help if we understood the real use case here and what you don't* like about the example syntax given.

--
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to