Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access hashivault modules in a collection #400

Open
a01fe opened this issue Mar 27, 2022 · 3 comments
Open

Cannot access hashivault modules in a collection #400

a01fe opened this issue Mar 27, 2022 · 3 comments

Comments

@a01fe
Copy link

a01fe commented Mar 27, 2022

I have ansible-modules-hashivault installed in a venv, playbooks running in that venv find hashivault modules okay.
References to hashivault module references in from a role in a collection get an error:

ERROR! couldn't resolve module/action 'hashivault_secret'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/Users/xxx/Projects/ansible/collections/ansible_collections/yyy/zzz/roles/vault/tasks/initialize.yaml': line 33, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


    - name: Save root token in bootstrap vault
      ^ here
@a01fe
Copy link
Author

a01fe commented Mar 27, 2022

I found a workaround here: https://stackoverflow.com/questions/65608888/ansible-module-not-found-when-using-collection

In meta/runtime.yml inside my collection, adding the following fixes the error:

---
plugin_routing:
  modules:
    hashivault_secret:
      redirect: ansible.legacy.hashivault_secret

@a01fe a01fe closed this as completed Mar 27, 2022
@TerryHowe TerryHowe reopened this Mar 28, 2022
@TerryHowe
Copy link
Owner

Might be something could be done here

@pat-s
Copy link

pat-s commented Jan 6, 2023

@a01fe Thanks for that find, that saved a huge problem for us!

The main underlying issue is that collections cannot depend on roles in ansible (apparently by design: https://stackoverflow.com/a/69559820/4185785). :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants