Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-detect modules from collection layouts
Makes local modules available to ansible when the plugins/modules exists on disk but only if the user did not already define ANSIBLE_LIBRARY. This means that from now on users are not forced to use use the old hack of defining ANSIBLE_LIBRARY=plugins/modules before running the linter, something that made it harder to use with pre-commit, tox, CI. If the variable is already defined or the folder does not exist, nothing is done. Fixes: #778
- Loading branch information
Showing
5 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- hosts: localhost | ||
gather_facts: false | ||
tasks: | ||
- name: Run custom module | ||
fake_module: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"""Sample custom ansible module named fake_module. | ||
This is used to test ability to detect and use custom modules. | ||
""" | ||
from ansible.module_utils.basic import AnsibleModule | ||
|
||
|
||
def main(): | ||
"""Return the module instance.""" | ||
return AnsibleModule( | ||
argument_spec=dict( | ||
data=dict(default=None), | ||
path=dict(default=None, type=str), | ||
file=dict(default=None, type=str), | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters