# Using powershell module in task: "no action detected"

**URL:** <https://forum.ansible.com/t/using-powershell-module-in-task-no-action-detected/20146>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [January 7, 2016, 9:25pm UTC](https://forum.ansible.com/t/using-powershell-module-in-task-no-action-detected/20146 "2016-01-07T21:25:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alvlin.uy](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@alvlin.uy](https://forum.ansible.com/u/alvlin.uy)\
**Post date:** [January 7, 2016, 9:25pm UTC](https://forum.ansible.com/t/using-powershell-module-in-task-no-action-detected/20146/1 "2016-01-07T21:25:07Z")

</div>

Hi,

I am working with a custom Windows module, to get a very specific piece of information living in my Windows machines.  
I followed the docs, wrote a powershell module and put it in library/windows/module.ps1. However, trying to use it results in

fatal: [[server.example.com](http://server.example.com)]: FAILED! =\> {“failed”: true, “reason”: “ERROR! no action detected in task\n\nThe error appears to have been in ‘/path/to/ansible/roles/gui/tasks/client.yml’: line 12, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Get client version installed on this server\n ^ here\n”}

The task was defined as

- name: Get client version installed on this server  
get\_client\_version: path=“{{ client\_path }}”  
register: app\_client

The error dissapears if I create an empty module called “module.py” or just “module” in library/

I searched the web and found a few similar issues reported against Ansible 1.8.x, but were fixed at the time, apparently. I’m hesitant to open a bug report since I recently opened a new one and was an already known, documented limitation. The current docs say:

Windows modules live in a “windows/” subfolder in the Ansible “library/” subtree. For example, if a module is named “library/windows/win\_ping”, there will be embedded documentation in the “win\_ping” file, and the actual PowerShell code will live in a “win\_ping.ps1” file. Take a look at the sources and this will make more sense.

The statement above does not match what I see in Ansible 2.0.0-0.7-rc2. Putting the “module” file in library/windows still causes the error to appear, so I would say the docs need to be corrected, or maybe I’m again doing something wrong 🙂

Regards

---

<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 7, 2016, 9:39pm UTC](https://forum.ansible.com/t/using-powershell-module-in-task-no-action-detected/20146/2 "2016-01-07T21:39:58Z")

</div>

Per the documentation, and it may not be clear, you should have both a `win_ping.ps1` and a `win_ping.py`. The `.py` is an expected file, including the YAML DOCUMENTATION for the module. It may not be a requirement that you have both any more, but I am guessing based on the problem, that you must have at least one `.py` file in the directory in order for it to be found correctly.

---

<div class="post-metadata">

**Author:** ![alvlin.uy](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@alvlin.uy](https://forum.ansible.com/u/alvlin.uy)\
**Post date:** [January 13, 2016, 3:59am UTC](https://forum.ansible.com/t/using-powershell-module-in-task-no-action-detected/20146/3 "2016-01-13T03:59:38Z")

</div>

Well, I moved the .ps1 to library/ and it started working just fine, no ".py" needed.  
What I wrote below about the error dissapearing was correct, but at the time I was getting some problems to access my windows box. When that access was restored, trying the playbook with an empty .py file just caused ansible to fail with a "missing interpreter line" error, or something like that. So, at this point it just looks like it is better to leave the .ps1 files at library/ instead of library/windows.

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [January 13, 2016, 8:45am UTC](https://forum.ansible.com/t/using-powershell-module-in-task-no-action-detected/20146/4 "2016-01-13T08:45:33Z")

</div>

If you want to pick up custom modules from more than the default /library location, you can configure this in your ansible.cfg in the [defaults]  
section

#library = /usr/share/my\_modules/

From what you have said it looks like it doesn’t recurse into subdirectories.

---

<div class="post-metadata">

**Author:** ![alvlin.uy](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@alvlin.uy](https://forum.ansible.com/u/alvlin.uy)\
**Post date:** [January 13, 2016, 2:10pm UTC](https://forum.ansible.com/t/using-powershell-module-in-task-no-action-detected/20146/5 "2016-01-13T14:10:21Z")

</div>

Thanks for your suggestion, but that is not the point. The docs ([http://docs.ansible.com/ansible/intro\_windows.html#developers-supported-modules-and-how-it-works](http://docs.ansible.com/ansible/intro_windows.html#developers-supported-modules-and-how-it-works)) say

“Windows modules live in a “windows/” subfolder in the Ansible “library/” subtree.”

Either I’m not reading it correctly, or the documents are not correct, since I’m not able to get a module inside library/windows to work properly.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 13, 2016, 3:25pm UTC](https://forum.ansible.com/t/using-powershell-module-in-task-no-action-detected/20146/6 "2016-01-13T15:25:06Z")

</div>

That is not supposed to be for custom library dirs, its how we set  
them up in core/extras repos. I'll update the docs.

---

<div class="post-metadata">

**Author:** ![alvlin.uy](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@alvlin.uy](https://forum.ansible.com/u/alvlin.uy)\
**Post date:** [January 14, 2016, 5:50pm UTC](https://forum.ansible.com/t/using-powershell-module-in-task-no-action-detected/20146/7 "2016-01-14T17:50:08Z")

</div>

alright, sorry for the confusion then 🙂

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 14, 2016, 5:57pm UTC](https://forum.ansible.com/t/using-powershell-module-in-task-no-action-detected/20146/8 "2016-01-14T17:57:06Z")

</div>

the docs were misleading, i updated the source to clarify, they'll be  
published soon.
