# ERROR: 'module' is not a legal parameter in an Ansible Playbook

**URL:** <https://forum.ansible.com/t/error-module-is-not-a-legal-parameter-in-an-ansible-playbook/13590>\
**Category:** Ansible Project\
**Created:** [October 1, 2013, 4:01pm UTC](https://forum.ansible.com/t/error-module-is-not-a-legal-parameter-in-an-ansible-playbook/13590 "2013-10-01T16:01:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.ibarra](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@michael.ibarra](https://forum.ansible.com/u/michael.ibarra)\
**Post date:** [October 1, 2013, 4:01pm UTC](https://forum.ansible.com/t/error-module-is-not-a-legal-parameter-in-an-ansible-playbook/13590/1 "2013-10-01T16:01:11Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [October 1, 2013, 4:51pm UTC](https://forum.ansible.com/t/error-module-is-not-a-legal-parameter-in-an-ansible-playbook/13590/2 "2013-10-01T16:51:56Z")

</div>

This discussion would be better suited to ansible-devel, if you don’t mind moving the conversation there.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 1, 2013, 4:58pm UTC](https://forum.ansible.com/t/error-module-is-not-a-legal-parameter-in-an-ansible-playbook/13590/3 "2013-10-01T16:58:56Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![michael.ibarra](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@michael.ibarra](https://forum.ansible.com/u/michael.ibarra)\
**Post date:** [October 1, 2013, 5:03pm UTC](https://forum.ansible.com/t/error-module-is-not-a-legal-parameter-in-an-ansible-playbook/13590/4 "2013-10-01T17:03:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 1, 2013, 5:11pm UTC](https://forum.ansible.com/t/error-module-is-not-a-legal-parameter-in-an-ansible-playbook/13590/5 "2013-10-01T17:11:45Z")

</div>

Please try things on Ansible 1.3 and let us know how it goes.

---

<div class="post-metadata">

**Author:** ![michael.ibarra](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@michael.ibarra](https://forum.ansible.com/u/michael.ibarra)\
**Post date:** [October 1, 2013, 7:41pm UTC](https://forum.ansible.com/t/error-module-is-not-a-legal-parameter-in-an-ansible-playbook/13590/6 "2013-10-01T19:41:33Z")

</div>

I’ll try it later,

Thanks for the help.
