Hi,
I wrote a simple module this afternoon and then discovered that it
really needs to be copied to the single, shared Ansible module
directory to be found by a playbook.
I would like to extend the module lookup to search multiple directories, to:
- provide a way for other modules, e.g. the proposed contrib library,
to be added
- allow project-specific modules
I found the relevant code and it was a simple change to make it search
through a list of paths instead, allowing:
ansible -M /usr/share/ansible:/path/to/another/library
Commit is here,
https://github.com/emgee/ansible/commit/3a447f8b3295c23589bfe5a5a010eb9bf6b6925a.
Assuming it's a change you agree with I think it's useful enough like
that. However, it would probably be nicer to be able to *extend* the
module search path to avoid knowing where Ansible's library is
installed.
There are probably a couple of options that would work here:
--module-path
as for my commit
--extend-module-path
append path(s) to above module path
Should be a safe change.
OR
--module-path
append path(s), could even be callable multiple times
--no-default-modules
don't include Ansible's library
Changes behaviour for anyone relying on current --module-path behaviour.
Firstly is this a good change to make? Secondly, would you prefer one
of the above command line changes (or something completely different)
before it's merged?
Thanks, Matt
Commit is here,
https://github.com/emgee/ansible/commit/3a447f8b3295c23589bfe5a5a010eb9bf6b6925a.
This seems reasonable, send me a pull request and we can include in 0.5
Assuming it’s a change you agree with I think it’s useful enough like
that. However, it would probably be nicer to be able to extend the
module search path to avoid knowing where Ansible’s library is
installed.
There are probably a couple of options that would work here:
–module-path
as for my commit
–extend-module-path
append path(s) to above module path
Using the existing option like you have now is best, where if you want to specify a module path
you just have to include the stock one too.
Keep it simple and explicit…
Commit is here,
https://github.com/emgee/ansible/commit/3a447f8b3295c23589bfe5a5a010eb9bf6b6925a.
This seems reasonable, send me a pull request and we can include in 0.5
Done.
Assuming it's a change you agree with I think it's useful enough like
that. However, it would probably be nicer to be able to *extend* the
module search path to avoid knowing where Ansible's library is
installed.
There are probably a couple of options that would work here:
--module-path
as for my commit
--extend-module-path
append path(s) to above module path
Using the existing option like you have now is best, where if you want to
specify a module path
you just have to include the stock one too.
Keep it simple and explicit...
Yep fair enough, and that's the reason why I did the obvious (and
easy) bit first and left the other bit for discussion.
- Matt