# Collection: adding ps1 script breaks anisble\_connection=local?

**URL:** <https://forum.ansible.com/t/collection-adding-ps1-script-breaks-anisble-connection-local/33423>\
**Category:** Ansible Project\
**Tags:** windows, galaxy-ng\
**Created:** [July 17, 2020, 8:53am UTC](https://forum.ansible.com/t/collection-adding-ps1-script-breaks-anisble-connection-local/33423 "2020-07-17T08:53:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romain\_Pelisse](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Romain\_Pelisse](https://forum.ansible.com/u/Romain_Pelisse)\
**Post date:** [July 17, 2020, 8:53am UTC](https://forum.ansible.com/t/collection-adding-ps1-script-breaks-anisble-connection-local/33423/1 "2020-07-17T08:53:23Z")

</div>

Hi,

I’m running into something weird, that is maybe a bug, but I would like to check this before reporting it.

I’m working on the [Ansible jcliff collection](https://github.com/wildfly-extras/ansible_collections_jcliff) and we recently added a ps1 script to our modules to support windows. However, now, the [collection seems to be broken](https://github.com/wildfly-extras/ansible_collections_jcliff/issues/23) if I use it locally (host: localhost) :

fatal: [localhost]: FAILED! =\> {“changed”: false, “module\_stderr”: “/bin/sh: powershell: command not found\n”, "…

As I am running on Linux, I don’t know why powershell is being looked up…

Is it a known issue? Do you see a possible workaroung? Maybe simply a way to use the install phase of “ansible-galaxy collection install” to remove/rename the ps1 script if being installed on Linux?

Thanks!

---

<div class="post-metadata">

**Author:** ![belaran](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/belaran/32/2703_2.png) [@belaran](https://forum.ansible.com/u/belaran)\
**Post date:** [July 21, 2020, 7:05am UTC](https://forum.ansible.com/t/collection-adding-ps1-script-breaks-anisble-connection-local/33423/2 "2020-07-21T07:05:48Z")

</div>

Friendly reminder : nobody ran into this issue before? I’ve seen some indication that people behind the module slurp has similar issue, but there was no clear fix…

---

<div class="post-metadata">

**Author:** ![Ompragash](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ompragash/32/9070_2.png) [@Ompragash](https://forum.ansible.com/u/Ompragash)\
**Post date:** [July 21, 2020, 7:18am UTC](https://forum.ansible.com/t/collection-adding-ps1-script-breaks-anisble-connection-local/33423/3 "2020-07-21T07:18:34Z")

</div>

Hi Romain,

I checked [Ansible jcliff collection](https://github.com/wildfly-extras/ansible_collections_jcliff) and as you added .ps1(for windows) script with the same module name as the .py(for Linux), Ansible considers the first module file i.e. jcliff.ps1 even when executing against a Linux node.

As native Ansible Windows modules prefixed with " **win\_"** , I would recommend you to modify the file name jcliff.ps1 to win\_jcliff.ps1 to avoid confusion.

Regards,  
Ompragash

---

<div class="post-metadata">

**Author:** ![belaran](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/belaran/32/2703_2.png) [@belaran](https://forum.ansible.com/u/belaran)\
**Post date:** [July 21, 2020, 8:27am UTC](https://forum.ansible.com/t/collection-adding-ps1-script-breaks-anisble-connection-local/33423/4 "2020-07-21T08:27:23Z")

</div>

Oh gosh, it’s that simple! Cool 🙂 we’ll do that then, thanks.

---

<div class="post-metadata">

**Author:** ![belaran](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/belaran/32/2703_2.png) [@belaran](https://forum.ansible.com/u/belaran)\
**Post date:** [July 29, 2020, 8:00am UTC](https://forum.ansible.com/t/collection-adding-ps1-script-breaks-anisble-connection-local/33423/5 "2020-07-29T08:00:55Z")

</div>

Hi,

Thanks for pointing this out! We’ve indeed separated the Windows scripts (see windows\_support branch) from the regular python scripts, but it leads to awful a lot of code duplication ☹ . We need to duplicate both the plugins/module/jcliff.py (into its own .ps1), but, as it turns out, we also need to have the plugins/actions/jcliff.py to be fully duplicated ☹ … Did we miss something here? If not, is there a way to enhance the “ansible-collection build” phase to generate (ie $ cp plugins/action/jcliff.py → win\_jcliff.ps1) the required duplicated files?

I have a feeling we are not on the right track here…
