From f7fe6dc19c4ce865641a5eb0c519f18bc7bccdff Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 17 Nov 2016 11:58:38 -0600 Subject: [PATCH] Don't fail on missing vars files for delegated hosts Fixes #17965 --- lib/ansible/vars/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index 4d2676c3ea..7a58454555 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -312,7 +312,10 @@ class VariableManager: except AnsibleParserError as e: raise else: - raise AnsibleFileNotFound("vars file %s was not found" % vars_file_item) + # if include_delegate_to is set to False, we ignore the missing + # vars file here because we're working on a delegated host + if include_delegate_to: + raise AnsibleFileNotFound("vars file %s was not found" % vars_file_item) except (UndefinedError, AnsibleUndefinedVariable): if host is not None and self._fact_cache.get(host.name, dict()).get('module_setup') and task is not None: raise AnsibleUndefinedVariable("an undefined variable was found when attempting to template the vars_files item '%s'" % vars_file_item, obj=vars_file_item)