mirror of
https://github.com/ansible/ansible.git
synced 2026-07-28 16:15:12 +02:00
* ansible_local should not trigger deprecation
fixes #86228
(cherry picked from commit ca6dc93dcc)
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ansible_local will no longer trigger variable injection default value deprecation.
|
||||
@@ -297,7 +297,7 @@ class VariableManager:
|
||||
|
||||
# push facts to main namespace
|
||||
if C.INJECT_FACTS_AS_VARS:
|
||||
deprecated_facts_vars = {k: _deprecate_top_level_fact(v) for k, v in clean_facts(facts).items()}
|
||||
deprecated_facts_vars = {k: (_deprecate_top_level_fact(v) if k != 'ansible_local' else v) for k, v in clean_facts(facts).items()}
|
||||
all_vars = _combine_and_track(all_vars, deprecated_facts_vars, "facts")
|
||||
else:
|
||||
# always 'promote' ansible_local
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
- hosts: localhost
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- debug:
|
||||
msg: '{{ansible_distribution}}'
|
||||
- debug:
|
||||
msg: '{{ansible_local}}'
|
||||
tags: alocal
|
||||
@@ -56,3 +56,9 @@ export ANSIBLE_CACHE_PLUGIN=notjsonfile
|
||||
|
||||
# check for plugin deprecation
|
||||
[ "$(ansible-doc -t cache notjsonfile --playbook-dir ./ | grep -c 'DEPRECATED:')" -eq "1" ]
|
||||
|
||||
# Injection default is deprecated
|
||||
[ "$(ANSIBLE_INJECT_FACT_VARS=1 ansible-playbook injectfacts.yml 2>&1 | grep -c 'INJECT_FACTS_AS_VARS')" -eq "0" ]
|
||||
|
||||
# Injection default is deprecated but not ansible_local
|
||||
[ "$(ansible-playbook injectfacts.yml --tags alocal 2>&1 | grep -c 'INJECT_FACTS_AS_VARS')" -eq "0" ]
|
||||
|
||||
Reference in New Issue
Block a user