diff --git a/lib/ansible/runner/lookup_plugins/subelements.py b/lib/ansible/runner/lookup_plugins/subelements.py index fef0f05575..f33aae717d 100644 --- a/lib/ansible/runner/lookup_plugins/subelements.py +++ b/lib/ansible/runner/lookup_plugins/subelements.py @@ -39,6 +39,7 @@ class LookupModule(object): if isinstance(terms[0], dict): # convert to list: if terms[0].get('skipped',False) != False: + # the registered result was completely skipped return [] elementlist = [] for key in terms[0].iterkeys(): @@ -51,6 +52,9 @@ class LookupModule(object): for item0 in elementlist: if not isinstance(item0, dict): raise errors.AnsibleError("subelements lookup expects a dictionary, got '%s'" %item0) + if item0.get('skipped',False) != False: + # this particular item is to be skipped + continue if not subelement in item0: raise errors.AnsibleError("could not find '%s' key in iterated item '%s'" % (subelement, item0)) if not isinstance(item0[subelement], list):