Replying to my self about the second part of my question re:

      - proto: all
        group_name: group-name

It came up that the group name has to unique in the region otherwise the 
call will fail. The AWS console on other hand allows creation of security 
groups with the same name in same region in case they belong to different 
VPC's.


On Thursday, May 28, 2015 at 2:33:51 PM UTC+10, Igor Cicimov wrote:
>
> I have the following as part of a play:
>
>   - ec2_group:
>      name: group-name
>      description: "firewall"
>      vpc_id: "{{ vpc_id }}"
>      region: "{{ region }}"
>      purge_rules: false
>      purge_rules_egress: false
>      rules:
>       - proto: tcp
>         from_port: 22
>         to_port: 22
>         cidr_ip: 0.0.0.0/0
>       ...
>       #- proto: all
>       #  group_name: group-name
>     register: group_sg
>
>   - debug: msg="group_id -- {{ group_sg.group_id }}"
>
> which fails with the error:
>
> TASK: [debug msg="group_id -- {{ group_sg.group_id }}"] 
> ********************** 
> fatal: [localhost] => One or more undefined variables: 'dict object' has 
> no attribute 'group_id'
>
> Isn't this the right way of getting this attribute? Or this is not an 
> option for a SG created inside VPC? The SG is being created fine though for 
> the specified VPC and region.
>
> Another thing is that I'm anable to use:
>
>       - proto: all
>         group_name: group-name
>
> as in the official Ansible page example in the rules since I'm getting the 
> following error:
>
> File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 
> 1226, in get_status
>     raise self.ResponseError(response.status, response.reason, body)
> boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
> <?xml version="1.0" encoding="UTF-8"?>
> <Response><Errors><Error><Code>InvalidGroup.NotFound</Code><Message>You 
> have specified two resources that belong to different 
> networks.</Message></Error></Errors><RequestID>dee577be-...</RequestID></Response>
>
> Any ideas?
>
> $ ansible --version
> ansible 1.9.1
>
>
> Thanks,
> Igor
>

-- 
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/5135d1c1-5d10-40ad-8a4b-22828b94a382%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to