# Iterating over list of lists

**URL:** <https://forum.ansible.com/t/iterating-over-list-of-lists/23268>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [December 15, 2016, 5:47pm UTC](https://forum.ansible.com/t/iterating-over-list-of-lists/23268 "2016-12-15T17:47:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chanaka\_Samarajeewa](https://avatars.discourse-cdn.com/v4/letter/c/4da419/32.png) [@Chanaka\_Samarajeewa](https://forum.ansible.com/u/Chanaka_Samarajeewa)\
**Post date:** [December 15, 2016, 5:47pm UTC](https://forum.ansible.com/t/iterating-over-list-of-lists/23268/1 "2016-12-15T17:47:39Z")

</div>

Hello,

I have a registered variable with the following output. How do I iterate the results to get groups-\>name and tags-\>Name ?

ok: [127.0.0.1] =\> {  
“ec2\_facts”: {  
“changed”: false,  
“msg”: “All items completed”,  
“results”: [  
{  
“\_ansible\_no\_log”: false,  
“changed”: false,  
“instances”: [  
{  
“ami\_launch\_index”: “0”,  
“architecture”: “x86\_64”,  
“client\_token”: “redacted”,  
“ebs\_optimized”: false,  
“groups”: [  
{  
“id”: “redacted”,  
“name”: “redacted”  
}  
],  
“hypervisor”: “xen”,  
“id”: “redacted”,  
“image\_id”: “redacted”,  
“instance\_profile”: {  
“arn”: “arn:aws:iam::redacted:instance-profile/redacted”,  
“id”: “redacted”  
},  
“interfaces”: [  
{  
“id”: “redacted”,  
“mac\_address”: “redacted”  
}  
],  
“kernel”: null,  
“key\_name”: “redacted”,  
“launch\_time”: “2016-12-02T23:05:05.000Z”,  
“monitoring\_state”: “enabled”,  
“persistent”: false,  
“placement”: {  
“tenancy”: “default”,  
“zone”: “eu-central-1a”  
},  
“private\_dns\_name”: “redacted”,  
“private\_ip\_address”: “redacted”,  
“public\_dns\_name”: “redacted”,  
“ramdisk”: null,  
“region”: “eu-central-1”,  
“requester\_id”: null,  
“root\_device\_type”: “ebs”,  
“source\_destination\_check”: “true”,  
“spot\_instance\_request\_id”: null,  
“state”: “running”,  
“tags”: {  
“redacted”: “redacted”,  
“Name”: “redacted”,  
“aws:autoscaling:groupName”: “redacted”  
},  
“virtualization\_type”: “hvm”,  
“vpc\_id”: “redacted”  
},

Thanks  
Chanaka
