Hi All! I cannot sort out how to itterate though this loop properly:
I have 2 data dictionaries:
applications:
- application_1
- application_2
and
big_var_collection:
application_1:
deployment_tasks:
- { cmd: 'bundle exec rake thing:1', metadata: 'yay' }
- { cmd: 'bundle exec rake thing:2', metadata: 'boo' }
application_2:
deployment_tasks:
- { cmd: 'bundle exec rake thing:3', metadata: 'yay' }
- { cmd: 'bundle exec rake thing:4', metadata: 'boo' }
In this example, I want to run 4 commands: cd into the directory and run
the `cmd`, IE:
cd ~/www/projects/application_1 && bundle exec rake thing:1
cd ~/www/projects/application_1 && bundle exec rake thing:2
cd ~/www/projects/application_2 && bundle exec rake thing:3
cd ~/www/projects/application_2 && bundle exec rake thing:4
I would have assumed that the following loop would work, but I always end
up with an access error of some sort
- name: run deployment tasks
shell: >
cd ~/www/projects/{{ item.0 }} && {{ item.1.cmd }}
with_nested:
- applications
- big_var_collection[item.0].deployment_tasks
Help?
--
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/9c12c77e-f1be-47b7-bd27-2dab2f01e84c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.