see here: https://groups.google.com/d/msg/ansible-project/qJ2UNWuaIJk/-S0GyDfTbPoJ
On Tuesday, 5 May 2015 02:12:31 UTC+2, DenMat Gone wrote: > > Thanks Matt, > > You're correct. > > On Tuesday, May 5, 2015 at 12:19:16 AM UTC+10, Matt Martz wrote: >> >> Case matters when accessing keys. >> >> Instead of cachenodes it should likely be CacheNodes. >> >> On Saturday, May 2, 2015, DenMat Gone <[email protected]> wrote: >> >>> 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 >>> >>> <https://groups.google.com/d/msgid/ansible-project/aa9d749f-e42d-4940-a443-44586afd1cbb%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> -- >> Matt Martz >> @sivel >> sivel.net >> >> -- 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/8bfe4f65-65cd-4816-b5ed-62a340c6b2e3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
