Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
When using query() inside the ansible playbook, ansible fails with the error mentioned in subject.
Version-Release number of selected component (if applicable):
ansible-6.3.0-1.el9.noarch
ansible-core-2.14.0-1.el9.x86_64
How reproducible:
Always.
Steps to Reproduce:
Execute some query() that invokes some 3rd-party module (like netbox.netbox)
ansible localhost -m debug -a "msg={{ query('netbox.netbox.nb_lookup', 'devices', api_endpoint='https://netbox.pcigdc.com', token='…', api_filter='name=cmp0100.na3.pcigdc.com') }}"
Sorry I don't have better reproducer but you may try it with some other collection plugin.
Actual results:
The full traceback is:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 111, in run
items = self._get_loop_items()
File "/usr/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 249, in _get_loop_items
items = templar.template(self._task.loop)
File "/usr/lib/python3.9/site-packages/ansible/template/__init__.py", line 724, in template
result = self.do_template(
File "/usr/lib/python3.9/site-packages/ansible/template/__init__.py", line 987, in do_template
res = self.environment.concat(rf)
File "/usr/lib/python3.9/site-packages/ansible/template/native_helpers.py", line 44, in ansible_eval_concat
head = list(islice(nodes, 2))
File "<template>", line 22, in root
File "/usr/lib/python3.9/site-packages/ansible/_vendor/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/ansible/template/__init__.py", line 816, in _query_lookup
return self._lookup(name, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/ansible/template/__init__.py", line 819, in _lookup
instance = lookup_loader.get(name, loader=self._loader, templar=self)
File "/usr/lib/python3.9/site-packages/ansible/plugins/loader.py", line 853, in get
return self.get_with_context(name, *args, **kwargs).object
File "/usr/lib/python3.9/site-packages/ansible/plugins/loader.py", line 876, in get_with_context
self._module_cache[path] = self._load_module_source(name, path)
File "/usr/lib/python3.9/site-packages/ansible/plugins/loader.py", line 826, in _load_module_source
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/usr/share/ansible/collections/ansible_collections/netbox/netbox/plugins/lookup/nb_lookup.py", line 25, in <module>
import pynetbox
File "/usr/lib/python3.9/site-packages/pynetbox/__init__.py", line 1, in <module>
from pkg_resources import get_distribution, DistributionNotFound
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3243, in <module>
def _initialize_master_working_set():
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3226, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3255, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 568, in _build_master
ws.require(__requires__)
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 886, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 772, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jinja2>=3.0.0' distribution was not found and is required by ansible-core
fatal: [localhost]: FAILED! =>
msg: 'Unexpected failure during module execution: The ''jinja2>=3.0.0'' distribution was not found and is required by ansible-core'
Expected results:
No failure.
Additional info:
[NA1][CHECK][root@bastion01b ansible]# grep -r "jinja2" /usr/lib/python3.9/site-packages/*/requires.txt
/usr/lib/python3.9/site-packages/ansible_core-2.14.0-py3.9.egg-info/requires.txt:jinja2>=3.0.0
This one is bundled inside Ansible but it is not very well cooperating with pkg_resources it seems.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (ansible-core bug fix and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2023:2182
Description of problem: When using query() inside the ansible playbook, ansible fails with the error mentioned in subject. Version-Release number of selected component (if applicable): ansible-6.3.0-1.el9.noarch ansible-core-2.14.0-1.el9.x86_64 How reproducible: Always. Steps to Reproduce: Execute some query() that invokes some 3rd-party module (like netbox.netbox) ansible localhost -m debug -a "msg={{ query('netbox.netbox.nb_lookup', 'devices', api_endpoint='https://netbox.pcigdc.com', token='…', api_filter='name=cmp0100.na3.pcigdc.com') }}" Sorry I don't have better reproducer but you may try it with some other collection plugin. Actual results: The full traceback is: Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 111, in run items = self._get_loop_items() File "/usr/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 249, in _get_loop_items items = templar.template(self._task.loop) File "/usr/lib/python3.9/site-packages/ansible/template/__init__.py", line 724, in template result = self.do_template( File "/usr/lib/python3.9/site-packages/ansible/template/__init__.py", line 987, in do_template res = self.environment.concat(rf) File "/usr/lib/python3.9/site-packages/ansible/template/native_helpers.py", line 44, in ansible_eval_concat head = list(islice(nodes, 2)) File "<template>", line 22, in root File "/usr/lib/python3.9/site-packages/ansible/_vendor/jinja2/runtime.py", line 298, in call return __obj(*args, **kwargs) File "/usr/lib/python3.9/site-packages/ansible/template/__init__.py", line 816, in _query_lookup return self._lookup(name, *args, **kwargs) File "/usr/lib/python3.9/site-packages/ansible/template/__init__.py", line 819, in _lookup instance = lookup_loader.get(name, loader=self._loader, templar=self) File "/usr/lib/python3.9/site-packages/ansible/plugins/loader.py", line 853, in get return self.get_with_context(name, *args, **kwargs).object File "/usr/lib/python3.9/site-packages/ansible/plugins/loader.py", line 876, in get_with_context self._module_cache[path] = self._load_module_source(name, path) File "/usr/lib/python3.9/site-packages/ansible/plugins/loader.py", line 826, in _load_module_source spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/usr/share/ansible/collections/ansible_collections/netbox/netbox/plugins/lookup/nb_lookup.py", line 25, in <module> import pynetbox File "/usr/lib/python3.9/site-packages/pynetbox/__init__.py", line 1, in <module> from pkg_resources import get_distribution, DistributionNotFound File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3243, in <module> def _initialize_master_working_set(): File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3226, in _call_aside f(*args, **kwargs) File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3255, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 568, in _build_master ws.require(__requires__) File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 886, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 772, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'jinja2>=3.0.0' distribution was not found and is required by ansible-core fatal: [localhost]: FAILED! => msg: 'Unexpected failure during module execution: The ''jinja2>=3.0.0'' distribution was not found and is required by ansible-core' Expected results: No failure. Additional info: [NA1][CHECK][root@bastion01b ansible]# grep -r "jinja2" /usr/lib/python3.9/site-packages/*/requires.txt /usr/lib/python3.9/site-packages/ansible_core-2.14.0-py3.9.egg-info/requires.txt:jinja2>=3.0.0 This one is bundled inside Ansible but it is not very well cooperating with pkg_resources it seems.