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",
                                "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

-- 
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/aa9d749f-e42d-4940-a443-44586afd1cbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to