From af06a97f17a94808d90fff0e9adc4d9a1b5781eb Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Sun, 23 Aug 2015 12:50:15 -0400 Subject: [PATCH] kept vars as alias to hostvars[inventory_hostname] and avoid subtrees into themselves --- lib/ansible/vars/__init__.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index fbae5cf2e4..27f7221252 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -294,11 +294,8 @@ class VariableManager: all_vars['ansible_version'] = CLI.version_info(gitinfo=False) - # make vars self referential, so people can do things like 'vars[var_name]' - copied_vars = all_vars.copy() - if 'hostvars' in copied_vars: - del copied_vars['hostvars'] - all_vars['vars'] = copied_vars + if 'hostvars' in all_vars and host: + all_vars['vars'] = all_vars['hostvars'][host.get_name()] #CACHED_VARS[cache_entry] = all_vars