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
Ansible 2.0 no longer finds modules in library subdirectories #15432
Comments
I think this happens to me as well, when using the yumrepo module. The weird thing is - it works fine on my workstation (Fedora 23, Python 2.7.11-3.fc23, Bash 4.3.42) but fails with this error on our server (CentOS 7, Python 2.7.5-34.el7, Bash 4.2.46). |
afaik its only been supported to have modules/plugins in custom library/ or <plugin_name>_plugins/ dir and not subdirs. |
@bcoca The use case here is to pull in third-party modules as git submodules by linking to them in the |
Ansible docs also state that this subdirectory is auto-loaded: http://docs.ansible.com/ansible/playbooks_best_practices.html#bundling-ansible-modules-with-playbooks |
that only points to ./library not sub directories of it. |
+1 Whether this was in documentation or not, it was very useful behavior in 1.9. Per @mrgnr, I have also being using git submodules and it worked well - several modules can be installed to the local ansible directory structure and they 'just worked'. With the current behavior, getting custom modules integrated into an ansible structure becomes a PITA as all custom modules would now have to exist in a single directory (./library). Presumably we'd need to clone the module into a separate directory and run some kind of installation script to copy over the module's source file. |
@bcoca - is there any additional information you need to keep this issue alive? Will you accept a PR? |
!needs_info |
I've added this to our core team meeting agenda to get a group decision. |
As a workaround, ANSIBLE_LIBRARY can take multiple paths (colon separated just like the PATH environment variable) so you can set each subdirectory as a path as well. I know this still requires two steps but it should be a little easier than moving the module out of the subdirectory to the toplevel ANSIBLE_LIBRARY every time it is updated. |
Thought you might want to see the meeting minutes: @mrgnr @relaxdiego @arikgam @dazwin @praymann @busrakoken @jseadragon @herbygillot @dschott |
Documentation for using the library configuration var to address this use case is in the following PR: #20913 |
* Add it to the sample ansible.cfg * Add it to intro_configuration. * Also modify intro_configuration to place envvars on equal footing with the config options (will need to document the envvar names in the future) * Also add the ANSIBLE_LIBRARY use case from ansible#15432 so we can close out that bug.
* Make the module_utils path configurable * Add a config value to define the path site module_utils files * Handle module_utils that do not have source as an error * Make an integration test for module_utils envvar working * Add documentation for the ANSIBLE_MODULE_UTILS config option/envvar * Add it to the sample ansible.cfg * Add it to intro_configuration. * Also modify intro_configuration to place envvars on equal footing with the config options (will need to document the envvar names in the future) * Also add the ANSIBLE_LIBRARY use case from #15432 so we can close out that bug.
PR with documentation has been merged to devel. Closing this ticket. |
ISSUE TYPE
ANSIBLE VERSION
CONFIGURATION
N/A
OS / ENVIRONMENT
N/A
SUMMARY
I'm upgrading from 1.9.1 to 2.0.1 and Ansible can no longer find modules contained in subdirectories of the
library
directory. Only modules at the top level oflibrary
are found. With Ansible <2.0, modules could be placed in subdirectories. This makes it difficult to use git submodules to add third-party modules to the library.STEPS TO REPRODUCE
library/my_module/
alongside a playbookmy_module
and place it inlibrary/my_module
my_module
from a playbookansible-playbook
EXPECTED RESULTS
ansible-playbook
should find the custom module when run.ACTUAL RESULTS
ansible-playbook
fails with the errorERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The text was updated successfully, but these errors were encountered: