"'ansible connection' is undefined." when templating conditionals in meta tasks. #82793
Open
1 task done
Labels
affects_2.16
bug
This issue/PR relates to a bug.
docs
This issue/PR relates to or includes documentation.
module
This issue/PR relates to a module.
Summary
When using the
ansible.builtin.meta
module with awhen:
condition which includes theansible_connection
variable, Ansible fails to evaluate the conditional, instead reporting that "'ansible_connection' is undefined".The debug module shows that the variable is defined and other modules do not seem to have the same problem.
Issue Type
Bug Report
Component Name
meta
Ansible Version
Configuration
OS / Environment
Steps to Reproduce
Configure a minimal test host with Python 3 and SSH. I tested against a Debian 12 container.
Then run the following playbook:
With:
ansible-playbook -i "172.17.0.3," -e 'ansible_user=root' ./test.yml
Replacing the IP as necessary. Note that the example uses the
end_play
command withansible.builtin.meta
, but the other commands exhibit the same behaviour.Expected Results
The conditional is evaluated correctly and the value of
ansible_connection
is tested.Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: