diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index b3369af2ca..dfa3131c66 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -583,8 +583,13 @@ class VariableManager: rval = AnsibleInventoryVarsData() rval.path = path + if data is not None: - rval.update(data) + if not isinstance(data, dict): + raise AnsibleError("Problem parsing file '%s': line %d, column %d" % data.ansible_pos) + else: + rval.update(data) + return rval def add_host_vars_file(self, path, loader):