Look up "with_nested" and "with_together" in the documentation for how to do nested loops.
On Sun, Jan 19, 2014 at 11:25 PM, Gonzalo Servat <[email protected]> wrote: > Hi All, > > I won't say "include + with_items" ;-) but I am looking for a way to run a > bunch of commands, sequentially, over a list. For example: > > paths: > - [ ['foo:/path/to/dir1', '/dir1'] ] > - [ ['foo:/path/to/dir2', '/dir2'] ] > - etc... > > In the playbook, I want to do a set of tasks over these paths... i.e: > > - name: create a temporary mount path > local_action: command mktemp -d > register: tempdir > - name: mount directory > local_action: shell mount `dirname {{ item.0 }}` {{ tempdir.stdout }} > *<do stuff with {{ item.1 }} and tempdir.stdout>* > - name: umount and delete temporary dir > local_action: shell umount {{ tempdir.stdout }} && rm -rf {{ > tempdir.stdout }} > > Any suggestions on how this can this be achieved? > > Thanks. > GS > > -- > 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]. > For more options, visit https://groups.google.com/groups/opt_out. > -- Michael DeHaan <[email protected]> CTO, AnsibleWorks, Inc. http://www.ansibleworks.com/ -- 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]. For more options, visit https://groups.google.com/groups/opt_out.
