ansible-modules-hashivault
ansible-modules-hashivault copied to clipboard
Cannot access hashivault modules in a collection
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
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
Might be something could be done here
@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). :/