Hi all,
I’m trying to run a module that I’ve written but I’m getting:
ERROR: ‘module’ is not a legal parameter in an Ansible Playbook’.
Where ‘module’ is located at /usr/share/ansible/mymodules/module as its specified in /etc/ansible/ansible.cfg.
I can run any other module located in the same directory as:
drwxr-xr-x 2 root root 4096 Sep 18 17:45 utilities
drwxr-xr-x 2 root root 4096 Sep 18 17:45 web_infrastructure
In the specification of the module, I put at the end of the file as the docs said:
this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
main()
I’m running ansible 1.2.3 in centos6 installed from yum repos.
Thanks for attending this message…
This discussion would be better suited to ansible-devel, if you don’t mind moving the conversation there.
FYI, should you wish to poke around, the code that governs module search and whether “shortname:” is valid in a playbook is handled by
https://github.com/ansible/ansible/blob/devel/lib/ansible/playbook/task.py
approximately line 101
Since you’re running 1.2.X still, and 1.3 is the current active release and a few months newer, I think we’ve probably fixed the underlying bug I’m thinking about. You may want to try there.
I don’t really consider this a module development issue.
I could tested my module hardcoding the ANSIBLE_LIBRARY and using it in command mode:
$export ANSIBLE_LIBRARY=path/to/mymodule/
$ansible [hosts] -m [‘module’] -a “var=‘foo’” -u root --ask-pass … and it worked.
However, I haven’t figured out yet how to manage this working with playbooks.
Please try things on Ansible 1.3 and let us know how it goes.