From 0c291ece1a3672a07086cfcbd73e3c000ec874c2 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 22 Aug 2017 11:39:35 -0400 Subject: [PATCH] remove fact namespacing since we want to make namespaced facts drop ansible_ prefix but don't have the time before release to perfect this feature, we are going to postpone it for now until we have the resources to fix this issue. That way we won't have people relying on the 'incorrect' names for a release. --- CHANGELOG.md | 2 -- lib/ansible/config/base.yml | 3 ++- lib/ansible/vars/manager.py | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ccc261cfb..d4ee1fd84f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,6 @@ Ansible Changes By Release * New import/include keywords to replace the old bare `include` directives. The use of `static: {yes|no}` on such includes is now deprecated. - Using `import_*` (`import_playbook`, `import_tasks`, `import_role`) directives are static. - Using `include_*` (`include_tasks`, `include_role`) directives are dynamic. -* Added fact namespacing, from now on facts will be available under `ansible_facts` namespace (i.e. `ansible_facts.ansible_os_distribution`). - They will continue to be added into the main namespace directly, but now a configuration toggle to disable this, currently off by default, in the future it will be on by default. This is done to avoid collisions and possible security issues as facts come from the remote targets and they might be compromised. * New `order` play level keyword that allows the user to change the order in which Ansible processes hosts when dispatching tasks. * Users can now set group merge priority for groups of the same depth (parent child relationship), using the new `ansible_group_priority` variable, when values are the same or don't exist it will fallback to the previous sorting by name'. diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 501ac3fdbe..8aefd2b499 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -1403,8 +1403,9 @@ NETWORK_GROUP_MODULES: - {key: network_group_modules, section: defaults} type: list yaml: {key: defaults.network_group_modules} -# Deffered to 2.5 #ONLY_NAMESPACE_FACTS: +# Deffered to 2.5 +# FIXME: reenable when we can remove ansible_ prefix from namespaced facts # default: False # description: # - Facts normally get injected as top level variables, this setting prevents that. diff --git a/lib/ansible/vars/manager.py b/lib/ansible/vars/manager.py index 22d6caced0..a29b186db6 100644 --- a/lib/ansible/vars/manager.py +++ b/lib/ansible/vars/manager.py @@ -336,6 +336,7 @@ class VariableManager: # finally, the facts caches for this host, if it exists try: host_facts = wrap_var(self._fact_cache.get(host.name, {})) + # push facts to main namespace all_vars = combine_vars(all_vars, host_facts) except KeyError: