ansible [core 2.15.8]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/demo/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/demo/.local/lib/python3.9/site-packages/ansible
ansible collection location = /home/demo/.ansible/collections:/usr/share/ansible/collections
executable location = /home/demo/.local/bin/ansible
python version = 3.9.18 (main, Nov 18 2023, 01:00:14) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/usr/bin/python3.9)
jinja version = 3.1.3
libyaml = True
Using /etc/ansible/ansible.cfg as config file
Parsed /mnt/data/awx/projects/awx/inventories/budibase.yml inventory source with ansible_collections.demo.sysops.plugins.inventory.budibase plugin
ansible_collections.demo.sysops.plugins.inventory.budibase declined parsing /mnt/data/awx/projects/awx/inventories/groups.yml as it did not pass its verify_file() method
Parsed /mnt/data/awx/projects/awx/inventories/groups.yml inventory source with yaml plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
ERROR! Unexpected Exception, this is probably a bug: 'Collection' object is not callable. If you meant to call the 'count' method on a 'Collection' object it is failing because no such method exists.
the full traceback was:
Traceback (most recent call last):
File "/home/demo/.local/lib/python3.9/site-packages/ansible/cli/__init__.py", line 659, in cli_executor
exit_code = cli.run()
File "/home/demo/.local/lib/python3.9/site-packages/ansible/cli/adhoc.py", line 190, in run
result = self._tqm.run(play)
File "/home/demo/.local/lib/python3.9/site-packages/ansible/executor/task_queue_manager.py", line 351, in run
play_return = strategy.run(iterator, play_context)
File "/home/demo/.local/lib/python3.9/site-packages/ansible/plugins/strategy/linear.py", line 180, in run
task_vars = self._variable_manager.get_vars(play=iterator._play, host=host, task=task,
File "/home/demo/.local/lib/python3.9/site-packages/ansible/vars/manager.py", line 310, in get_vars
facts = wrap_var(self._fact_cache.get(host.name, {}))
File "/usr/lib64/python3.9/_collections_abc.py", line 763, in get
return self[key]
File "/home/demo/.local/lib/python3.9/site-packages/ansible/vars/fact_cache.py", line 31, in __getitem__
if not self._plugin.contains(key):
File "/home/demo/.local/lib/python3.9/site-packages/ansible_collections/community/mongodb/plugins/cache/mongodb.py", line 185, in contains
return bool(collection.count({'_id': self._make_key(key)}))
File "/home/demo/.local/lib/python3.9/site-packages/pymongo/collection.py", line 3507, in __call__
raise TypeError(
TypeError: 'Collection' object is not callable. If you meant to call the 'count' method on a 'Collection' object it is failing because no such method exists.
SUMMARY
Fact caching with MongoDB fact cache plugin
community.mongodb.mongodb
is not working with pymongo 4.6.1. According to the issues https://github.com/ansible-collections/community.mongodb/issues/423 and https://github.com/ansible-collections/community.mongodb/issues/424 this should already been fixed (?).With pymongo 3.12.2 everything works fine.
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Rocky Linus 8 on WSL2
STEPS TO REPRODUCE
EXPECTED RESULTS
Facts should be successfully cached in MongoDB
ACTUAL RESULTS