# this module requires key=value arguments (\['\<\<INCLUDE\_ANSIBLE\_MODULE\_ARGS\>\>'\])

**URL:** <https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361>\
**Category:** Ansible Developer\
**Created:** [January 23, 2015, 10:19am UTC](https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361 "2015-01-23T10:19:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Schroeder](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Daniel\_Schroeder](https://forum.ansible.com/u/Daniel_Schroeder)\
**Post date:** [January 23, 2015, 10:19am UTC](https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361/1 "2015-01-23T10:19:29Z")

</div>

Dear \*,

trying to create a new plugin. It’s gonna be a variation of the [_lineinfile_ module](https://github.com/ansible/ansible-modules-core/blob/devel/files/lineinfile.py), so I copied the code from there and placed it into my local action plugins folder, as configured in my ansible.cfg

I didn’t change anything yet, it is the original _lineinfile.py_ so I’d expect the same behavior. Though instead I get an error I don’t understand:

`TASK: [calling testmodule] ****************************************************************** {"msg": "this module requires key=value arguments (['<<INCLUDE_ANSIBLE_MODULE_ARGS>>'])", "failed": true}`

This error happens when the [AnsibleModule class](https://github.com/ansible/ansible/blob/e6b5cc9ccb62dcf599be0b2c83887b223b82a68c/lib/ansible/module_utils/basic.py#L255) is initiated. Obviously the [replacement](https://github.com/ansible/ansible/blob/c75aeca43509fe0be71c3d3dceb5ccf04112ff7f/lib/ansible/module_common.py#L31) is not happening.

This is my task, which triggers my test module.

`

- name: calling testmodule  
testmodule: dest=“some-file” line=“some-line”  
`

The module gets called. A debug message at the beginning of the _main()_ method gets shown on the command line when executed.

There is nothing wrong with the params definition. When I replace my “testmodule” with the original “lineinfile” it instantly works.

This is Ansible 1.8.2 but I tested it with other version too, down to 1.6.5 and I get the same error.

Why is Ansible failing to replace the _INCLUDE\_ANSIBLE\_MODULE\_ARGS_? What am I missing, how to fix it?

Thanks,  
Daniel

---

<div class="post-metadata">

**Author:** ![Giovanni\_Tirloni](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Giovanni\_Tirloni](https://forum.ansible.com/u/Giovanni_Tirloni)\
**Post date:** [January 23, 2015, 11:31am UTC](https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361/2 "2015-01-23T11:31:06Z")

</div>

I tried to reproduce this issue but it worked just fine for me:

1. Copy modules/files/lineinfile.py to modules/files/testmodule.py  
2. Replace all occurrences of "lineinfile" with "testmodule" in  
testmodule.py  
3. Run playbook

$ ansible-playbook testmodule.yml  
PLAY [test line in file]

---

<div class="post-metadata">

**Author:** ![Daniel\_Schroeder](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Daniel\_Schroeder](https://forum.ansible.com/u/Daniel_Schroeder)\
**Post date:** [January 23, 2015, 11:55am UTC](https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361/3 "2015-01-23T11:55:16Z")

</div>

Thanks for looking into it Giovanni.

My py file really is just a copy of the original with the replaced name in the _DOCUMENTATION / EXAMPLES_ sections but I think that wouldn’t matter. I created a gist here, which includes all other things involved too: [https://gist.github.com/udondan/527c493cf19a370c9c01](https://gist.github.com/udondan/527c493cf19a370c9c01)

Cheers,  
Daniel

---

<div class="post-metadata">

**Author:** ![Giovanni\_Tirloni](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Giovanni\_Tirloni](https://forum.ansible.com/u/Giovanni_Tirloni)\
**Post date:** [January 23, 2015, 12:55pm UTC](https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361/4 "2015-01-23T12:55:15Z")

</div>

With oc\_lineinfile.py I get an error, but not the same as you (tested on  
1.8.2 and devel):

TASK: [calling testmodule]

---

<div class="post-metadata">

**Author:** ![Daniel\_Schroeder](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Daniel\_Schroeder](https://forum.ansible.com/u/Daniel_Schroeder)\
**Post date:** [January 23, 2015, 1:06pm UTC](https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361/5 "2015-01-23T13:06:41Z")

</div>

> Any modifications to Ansible core files?

Nope. I modified some files in the past to debug other problems but that all got reverted. To make sure I just deleted & re-installed Ansible through Homebrew (_brew uninstall --force ansible && brew install ansible_)

Btw, this is OS X 10.10.1 here and Python is 2.7.9.

Cheers,  
Daniel

---

<div class="post-metadata">

**Author:** ![Daniel\_Schroeder](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Daniel\_Schroeder](https://forum.ansible.com/u/Daniel_Schroeder)\
**Post date:** [January 26, 2015, 1:24pm UTC](https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361/6 "2015-01-26T13:24:06Z")

</div>

Giovanni,

may I ask how you integrated the plugin? That’s the key to reproduce the problem, as I just figured out.

Plugins which are placed in a _plugin_ directory inside a role, run just fine. The problem occurs when the plugin is inside the plugins directory which was defined in the _ansible.cfg_ @ _action\_plugins_.

I created a reproducible example. I tested this on 3 different systems with different operating systems and got the same result everywhere. Tested on:

- OS X 10.10.1 with Python 2.7.9
- CentOS 7 with Python 2.7.5
- Debian 7.5 with Python 2.7.3

You’ll find the code on Github: [https://github.com/udondan/ansible\_plugin\_issue](https://github.com/udondan/ansible_plugin_issue)

Clone it:

`$ git clone https://github.com/udondan/ansible_plugin_issue`

Run it:

`  
$ cd ansible\_plugin\_issue  
$ ansible-playbook -i inventory.conf test.yml

PLAY [Testing plugins] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost]

TASK: [testrole | Run plugin A] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [localhost]

TASK: [testrole | Run plugin B] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
DEBUG: module called!  
{“msg”: “this module requires key=value arguments ([‘\<\<INCLUDE\_ANSIBLE\_MODULE\_ARGS\>\>’])”, “failed”: true}  
`

The plugin file itself is at _/the-plugin.py_  
There are two symlinks, one below the “testrole” as _plugin\_A_, one below _plugins/action_ as _plugin\_B_. _plugin\_A_ runs just fine, _plugin\_B_ fails with the known error message. Since the plugins are symlinks, there’s no doubt they are identical. But just to make this clear, the problem is not caused because they are symlinks. I of course tested this with real files and also changed the module name in the documentation section, which really does not make any difference.

It appears to me like a general bug since I can reproduce it on various systems. Just wondering why nobody experienced this before. It’s not even a new problem, since I tested this back until Ansible 1.6.5.

Can you (or just anybody) confirm this works or not for you?

Cheers,  
Daniel

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [January 26, 2015, 1:34pm UTC](https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361/7 "2015-01-26T13:34:00Z")

</div>

action plugins are not the same as modules. You want to place your module in the location of ‘library’ instead of ‘action\_plugins’.

Move ‘plugins/action’ to ‘library’ and you will see this start working.

There are a few implicit locations where ‘library’ is looked for, such as placing a directory named ‘library’ at the same level as your playbook, and placing the file inside of there. As you have determined, this also works in roles, since you have ‘plugin\_A.py’ in a library directory in the root of your role.

---

<div class="post-metadata">

**Author:** ![Daniel\_Schroeder](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Daniel\_Schroeder](https://forum.ansible.com/u/Daniel_Schroeder)\
**Post date:** [January 26, 2015, 2:22pm UTC](https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361/8 "2015-01-26T14:22:42Z")

</div>

Thanks Mark!

I think the source of my confusion is the documentation here. Can someone explain what exactly is the difference between a module and a plugin (especially an action plugin)? According to the docs, [modules are reusable units of magic](http://docs.ansible.com/developing_modules.html), which is not very helpful. 😉 Only in the [Glossary](http://docs.ansible.com/glossary.html#modules) I now found a description. Action plugins are completely missing in the docs, both in the Glossary and on the [Developing Plugins page](http://docs.ansible.com/developing_plugins.html). I only learned about action plugins by discovering the [action\_plugins](http://docs.ansible.com/intro_configuration.html#action-plugins) setting in the config and trial and error…

I also created several action plugins before which I don’t see how they work any different than the _lineinfile_ module. (Apart from that you can use the _AnsibleModule_ class in one and not in the other) Is it that plugins run locally and modules remotely?

Thanks,  
Daniel

---

<div class="post-metadata">

**Author:** ![Daniel\_Schroeder](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Daniel\_Schroeder](https://forum.ansible.com/u/Daniel_Schroeder)\
**Post date:** [January 26, 2015, 2:30pm UTC](https://forum.ansible.com/t/this-module-requires-key-value-arguments-include-ansible-module-args/17361/9 "2015-01-26T14:30:13Z")

</div>

Mark? I meant Matt. Sorry! Let’s say it was autocorrection!
