summaryrefslogtreecommitdiff
path: root/lib/ansible/vars/clean.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/vars/clean.py')
-rw-r--r--lib/ansible/vars/clean.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/ansible/vars/clean.py b/lib/ansible/vars/clean.py
index 7b29383c2e..1987e3c57e 100644
--- a/lib/ansible/vars/clean.py
+++ b/lib/ansible/vars/clean.py
@@ -156,10 +156,9 @@ def namespace_facts(facts):
''' return all facts inside 'ansible_facts' w/o an ansible_ prefix '''
deprefixed = {}
for k in facts:
- if k in ('ansible_local',):
- # exceptions to 'deprefixing'
- deprefixed[k] = module_response_deepcopy(facts[k])
+ if k.startswith('ansible_') and k not in ('ansible_local',):
+ deprefixed[k[8:]] = module_response_deepcopy(facts[k])
else:
- deprefixed[k.replace('ansible_', '', 1)] = module_response_deepcopy(facts[k])
+ deprefixed[k] = module_response_deepcopy(facts[k])
return {'ansible_facts': deprefixed}