Interview Prep/Ansible/Roles, Collections and Galaxy

`[WARNING]: The specified collections path '/opt/collections' is not part of the configured Ansible collections paths ... The installed collection will not be picked up in an Ansible run`

IntermediateTroubleshootingRoles, Collections and Galaxy
Answer

Likely causes → The collection was installed with -p /opt/collections, but collections_path in ansible.cfg (or ANSIBLE_COLLECTIONS_PATH) does not include that folder.

Fix →

[defaults]
collections_path = ./collections:~/.ansible/collections:/usr/share/ansible/collections

Or install into a collections/ folder next to the playbook, which Ansible always searches.

Prevent → Use one documented install path per project, and check with ansible-galaxy collection list in CI.

All Ansible questions Roadmap: Ansible

More on Roles, Collections and Galaxy