Ansible – ERROR! Couldn’t Resolve Module/Action ‘community.general.timezone’ on RH8

ansibleansible-galaxy

I have this error

ERROR! couldn't resolve module/action 'community.general.timezone'
OS is RedHat 8
ansible 2.9.27
Ansible installed via yum

So I installed missing modules via ansible-galaxy, but when I run playbook ( as normal user) I get still the same error :ERROR! couldn't resolve module/action How can I register these pugins to system ?

#ansible-galaxy collection install community.general Process install dependency map Starting collection install process Installing 'community.general:6.1.0' to '/root/.ansible/collections/ansible_collections/community/general'

Best Answer

Ansible 2.9 was before usable collections support existed. And prior to the split from mono repo into many collections. So it should be in your Ansible package already.

Ignore everything to do with collections. Delete long name community.general.timezone in your task list and instead use timezone

If you were to mess with collections (don't, upgrade Ansible first) you would need to pin to an earlier version. Like several active collections, community.general drops testing for unsupported ansible-core versions. As of 2022, community.general 6 only supports ansible-core 2.11 and later.