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.
On Dec 8, 2015 1:24 PM, "Dinil" <[email protected]> wrote:
> Hi,
> Am trying to use Loop for 'Volumes' parameter of ec2 -
>
> 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
>
> --
> 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/caf7d5fe-1e00-4cba-be82-2c8e4eecedbe%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/caf7d5fe-1e00-4cba-be82-2c8e4eecedbe%40googlegroups.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/CAJ5XC8kSnF-tB9fDr7%2B23CrrRNBC9kLmdMW-t-13XF5%2Bua%2BxVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.