pull/85486/merge
Sloane Hertel 20 hours ago committed by GitHub
commit 4b796b97fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
bugfixes:
- >-
``environment`` keyword - env vars defined with ``ansible_env`` are no longer
silently ignored when ``ansible_env`` is undefined for actions other than
setup and gather_facts.

@ -420,7 +420,7 @@ class Task(Base, Conditional, Taggable, CollectionSearch, Notifiable, Delegatabl
return
except AnsibleUndefinedVariable as e:
error = to_native(e)
if self.action in C._ACTION_FACT_GATHERING and 'ansible_facts.env' in error or 'ansible_env' in error:
if self.action in C._ACTION_FACT_GATHERING and ('ansible_facts.env' in error or 'ansible_env' in error):
# ignore as fact gathering is required for 'env' facts
return
raise

@ -187,3 +187,19 @@
assert:
that:
- test_foo.results[0].stdout == 'outer'
- hosts: localhost
gather_facts: no
tasks:
- shell: echo $PATH
environment:
PATH: "/usr/local/bin/:{{ ansible_env.PATH }}"
ignore_errors: true
register: fatal
- assert:
that:
- fatal is failed
- fatal.msg is search(expected)
vars:
expected: "Error processing keyword 'environment': 'ansible_env' is undefined"

Loading…
Cancel
Save