Thanks Pshem, worked for me!

Cheers!
Nirjhar


On Monday, September 4, 2017 at 4:13:13 PM UTC+5:30, Pshem Kowalczyk wrote:
>
> You need a number of separate steps:
>
> 1. Get VPC id  (ec2_vpc_net_facts)
> 2. Get list of instances in that VPC using vpc-id as a filter 
> (ec2_remote_facts)
> 3. Get the list of ENIs for each of those EC2 instances (ec2_eni_facts)
>
> The last module will return information about security groups used by the 
> ENIs.
>
> kind regards
> Pshem
>
>
>
>
> On Mon, 4 Sep 2017 at 22:12 Nirjhar Banik <banik....@gmail.com 
> <javascript:>> wrote:
>
>> I'm trying to pull all the information of all the instances per VPC and 
>> get security group of each instance for a particular zone. I am using 
>> *ec2_vpc* (it is deprecated) module to get the information about 
>> an existing VPC but from reading the docs, I'm not completely sure this 
>> is possible since all the docs and examples are assuming you are 
>> either creating a VPC or deleting one.
>>
>> Can anyone help me with a solution of how to get the full list of ec2 
>> instance info for a particular region? Thanks!
>>
>> ---
>>  - name: List all the vpc ids
>>    hosts: webservers
>>    tasks:
>>     - name: ec2 instances
>>       ec2_vpc :
>>        aws_access_key: XXXXXXXXXX
>>        aws_secret_key: XXXXXXXXXXXXXXXXXXXX
>>       with_items:  
>>        -  us-east-1 
>>       register: vpc_info
>>
>> -- 
>> 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 <javascript:>.
>> To post to this group, send email to ansible...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/1d0ae7b5-f12c-4b51-a8ca-7ecec1c89dc1%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/1d0ae7b5-f12c-4b51-a8ca-7ecec1c89dc1%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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0a24f43c-9529-4d12-a380-babd39bc78e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to