# retrieving endpoint from data in the elasticache module

**URL:** <https://forum.ansible.com/t/retrieving-endpoint-from-data-in-the-elasticache-module/18150>\
**Category:** Ansible Project\
**Created:** [May 3, 2015, 1:37am UTC](https://forum.ansible.com/t/retrieving-endpoint-from-data-in-the-elasticache-module/18150 "2015-05-03T01:37:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DenMat\_Gone](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@DenMat\_Gone](https://forum.ansible.com/u/DenMat_Gone)\
**Post date:** [May 3, 2015, 1:37am UTC](https://forum.ansible.com/t/retrieving-endpoint-from-data-in-the-elasticache-module/18150/1 "2015-05-03T01:37:52Z")

</div>

Hi all,

I have a question regarding the data returned from the elasticache module.

I am able to create a memcached elasticache endpoint but I would like to retrieve that endpoint for use later in the playbook.

I register the result and can use debug to show that all the data I need is returned.

So something like the following:

- name: create utilities elasticcache  
elasticache:  
name: “utilities-elc”  
…  
\< snip \>  
…

register: utilities\_elc

- debug: var=utilities\_elc.elasticache.data  
register: utilities\_elc\_data

- debug: var=utilities\_elc\_data

That returns what I expect:

TASK: [vpc | debug var=utilities\_elc\_data] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“var”: {  
“utilities\_elc\_data”: {  
“invocation”: {  
“module\_args”: “var=utilities\_elc.elasticache.data”,  
“module\_name”: “debug”  
},  
“var”: {  
“utilities\_elc.elasticache.data”: {  
“AutoMinorVersionUpgrade”: true,  
“CacheClusterCreateTime”: 1430609910.496,  
“CacheClusterId”: “utilities-elc”,  
“CacheClusterStatus”: “available”,  
“CacheNodeType”: “cache.m3.medium”,  
“CacheNodes”: [  
{  
“CacheNodeCreateTime”: 1430609910.496,  
“CacheNodeId”: “0001”,  
“CacheNodeStatus”: “available”,  
“Endpoint”: {  
“Address”: “[utilities-elc.i4w6la.0001.apse2.cache.amazonaws.com](http://utilities-elc.i4w6la.0001.apse2.cache.amazonaws.com)”,  
“Port”: 11211  
},  
“ParameterGroupStatus”: “in-sync”,  
“SourceCacheNodeId”: null  
}  
],

…  
}

So my solution I tried to get the endpoint is:  
utilities\_elc.elasticache.data.cachenodes[0].endpoint.address

But that returns:  
“One or more undefined variables: ‘dict object’ has no attribute ‘cachenodes’”

I would have thought that worked? What aren’t I getting?

If I use a with\_dict: on the variable I can list the cachenodes key so it is baffling me.

Regards,  
Den

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [May 4, 2015, 2:19pm UTC](https://forum.ansible.com/t/retrieving-endpoint-from-data-in-the-elasticache-module/18150/2 "2015-05-04T14:19:12Z")

</div>

Case matters when accessing keys.

Instead of cachenodes it should likely be CacheNodes.

---

<div class="post-metadata">

**Author:** ![DenMat\_Gone](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@DenMat\_Gone](https://forum.ansible.com/u/DenMat_Gone)\
**Post date:** [May 5, 2015, 12:12am UTC](https://forum.ansible.com/t/retrieving-endpoint-from-data-in-the-elasticache-module/18150/3 "2015-05-05T00:12:31Z")

</div>

Thanks Matt,

You’re correct.

---

<div class="post-metadata">

**Author:** ![vaida.dan](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vaida.dan](https://forum.ansible.com/u/vaida.dan)\
**Post date:** [July 20, 2015, 1:59pm UTC](https://forum.ansible.com/t/retrieving-endpoint-from-data-in-the-elasticache-module/18150/4 "2015-07-20T13:59:19Z")

</div>

see here: [https://groups.google.com/d/msg/ansible-project/qJ2UNWuaIJk/-S0GyDfTbPoJ](https://groups.google.com/d/msg/ansible-project/qJ2UNWuaIJk/-S0GyDfTbPoJ)
