Interview Prep/Ansible/Roles, Collections and Galaxy

A custom collection module fails with `Could not find imported module support code for ansible_collections.acme.app.plugins.modules.app_config. Looked for (['ansible.module_utils.app_helpers', ...])`

AdvancedTroubleshootingRoles, Collections and Galaxy
Answer

Likely causes → The module imports its helper the old, non-collection way (from ansible.module_utils.app_helpers import ...). Inside a collection, module_utils must be imported by their full collection path, so that AnsiballZ can bundle them.

Fix →

from ansible_collections.acme.app.plugins.module_utils.app_helpers import render_config

Make sure the file exists at plugins/module_utils/app_helpers.py, and rebuild and reinstall the collection.

Prevent → Run ansible-test sanity and unit tests for every collection before publishing. They catch broken imports.

All Ansible questions Roadmap: Ansible

More on Roles, Collections and Galaxy