ec2:
prop1:
prop2:
volumes:
- device_name : {{ item.key1 }}
- volume_size: {{ item.key2 }}
with_items: {{ var}}
var:
{ 'key1' : 'value1' , 'key2' : 'value2'}
{ 'key1' : 'value3' , 'key2' : 'value4'}
I also did try with_dict but the loop does not correspond to the sub-element 'volumes', instead when it works without syntax errors, it creates multiple EC2 instances - each for one in the loop with the volume value.
Please advise how to use the ec2 module with loop for volumes, or if I have got looping sub-items incorrectly please hint on what am doing wrong.
Regards
The loop is for the whole task, that is why you get multiple instances. What you want is to pass the datastucture to the volumes key, jinja filters should help you with this.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/caf7d5fe-1e00-4cba-be82-2c8e4eecedbe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.