for x in tasks: if not isinstance(x, dict): raise errors.AnsibleError("expecting dict; got: %s" % x)