with_items
flattening nested environment
s to top level instead of using most nested
#33358
Labels
affects_2.4
This issue/PR affects Ansible v2.4
bug
This issue/PR relates to a bug.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
ISSUE TYPE
COMPONENT NAME
core
(
with_items
and nestedenvironment
s)ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Control + Remote (local playbook):
Centos 7
SUMMARY
Use of
with_items
in acommand
task that runs within a nested set ofenvironment
s is flattening the nesting and reverting to the top levelenvironment
instead of keeping the most nestedenvironment
STEPS TO REPRODUCE
Create the below files in a single directory and then run this command from within that directory:
SHELL_ENV_VAR=shell_env_var SHARED_ENV_VAR=shell_env_var ansible-playbook playbook.yml -i localhost, -c local -v
ansible.cfg
playbook.yml
first-level-tasks.yml
second-level-tasks.yml
EXPECTED RESULTS
The command
stdout
/stdout_lines
from both tasks insecond-level-tasks.yml
(TASK [Command singular]
andTASK [Command with items]
) should be identicalACTUAL RESULTS
The addition of
with_items: [1]
(which should be a non-semantic change to a command that doesn't actually reference the{{ item }}
s) causes the output of the task to change. It appears that the nestedenvironment
is reverting to the top-level (i.e. playbook level)environment
whenwith_items
is used (see playbook output below)The text was updated successfully, but these errors were encountered: