You may wish to just define the list as a variable and do

attribute: "{{ listvar }}"

To plug in the list from your variable file




On Tue, Aug 5, 2014 at 5:32 AM, Chuzzy <[email protected]> wrote:

>
> Thanks, Tomasz ..
>
> But this will result in my creating a huge number of security groups ..
> the intention is to create a list of rules for a security group ..
>
> the ideal solution would be to have the loop work on a 'rule' level .. and
> not at the SG level, so that each iteration points to a new rule instead of
> a new SG ..
>
> Without such a change, using with_items or any other loop for managing
> rules is not really useful  ..
>
>
> On Tuesday, 5 August 2014 06:42:27 UTC+1, Tomasz Kontusz wrote:
>
>> Try to give the groups different names.
>> You can use:
>>
>> with_items:
>> - ip: addr1/32
>> name: group1
>>
>> And then access that data with {{ item.ip }} and {{ item.name }}.
>>
>> Chuzzy <[email protected]> napisał:
>>
>>>
>>> Thanks for the response .. much appreciated.
>>>
>>> And yes, I have seen that's the only way it works ,, I do ponder what I
>>> have to do to have it create a security group per item element(s) .. or is
>>> this an incorrect usage?
>>>
>>> Thanks again ..
>>>
>>> On Monday, 4 August 2014 21:22:08 UTC+1, Michael DeHaan wrote:
>>>>
>>>> You have an indentation error here for starters:
>>>>
>>>> - name: Create security group
>>>>   ec2_group:
>>>>     name: "some-name"
>>>>     description: "some description"
>>>>     vpc_id: "vpc-blahblah"
>>>>     region: "eu-north-4"
>>>>     rules:
>>>>     - proto: tcp
>>>>       from_port: 443
>>>>       to_port: 443
>>>>       cidr_ip: "{{ item }}"
>>>>       with_items:
>>>>         - addr1/32
>>>>         - addr2/32
>>>>         - etc/32
>>>>
>>>> with_items should be at the same level as "ec2_group".
>>>>
>>>>
>>>>
>> --
>> Wysłane za pomocą K-9 Mail.
>>
>  --
> 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/38fbc55c-5429-49cc-b607-768059a5370c%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/38fbc55c-5429-49cc-b607-768059a5370c%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/CA%2BnsWgw8QhNX0hz6yn%2Bd0QKKHJ9uYsxiJyQU_d2MfJffXj056g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to