I need to do something like this in a role, and I use an endpoint for some of the items in the hash I feed it
TASK: [gavdeploy | wait for endpoints to become available] ********************
fatal: [ststxdapbe02] => Traceback (most recent call last):
File "/usr/local/Cellar/ansible/1.9.3/libexec/lib/python2.7/site-packages/ansible/runner/__init__.py", line 586, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/usr/local/Cellar/ansible/1.9.3/libexec/lib/python2.7/site-packages/ansible/runner/__init__.py", line 815, in _executor_internal
complex_args=complex_args
File "/usr/local/Cellar/ansible/1.9.3/libexec/lib/python2.7/site-packages/ansible/runner/__init__.py", line 869, in _executor_internal_inner
if not utils.check_conditional(cond, self.basedir, inject, fail_on_undefined=self.error_on_undefined_vars):
File "/usr/local/Cellar/ansible/1.9.3/libexec/lib/python2.7/site-packages/ansible/utils/__init__.py", line 265, in check_conditional
conditional = template.template(basedir, conditional, inject, fail_on_undefined=fail_on_undefined)
File "/usr/local/Cellar/ansible/1.9.3/libexec/lib/python2.7/site-packages/ansible/utils/template.py", line 122, in template
varname = template_from_string(basedir, varname, templatevars, fail_on_undefined)
File "/usr/local/Cellar/ansible/1.9.3/libexec/lib/python2.7/site-packages/ansible/utils/template.py", line 371, in template_from_string
res = jinja2.utils.concat(rf)
File "<template>", line 8, in root
File "/usr/local/Cellar/ansible/1.9.3/libexec/vendor/lib/python2.7/site-packages/jinja2/runtime.py", line 489, in _fail_with_undefined_error
raise self._undefined_exception(hint)
UndefinedError: 'dict object' has no attribute 'endpoint'
FATAL: all hosts have already failed -- aborting