# how can i get around this error?

**URL:** <https://forum.ansible.com/t/how-can-i-get-around-this-error/36160>\
**Category:** Ansible Project\
**Created:** [December 30, 2021, 8:16am UTC](https://forum.ansible.com/t/how-can-i-get-around-this-error/36160 "2021-12-30T08:16:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kerem\_Kalayci](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@Kerem\_Kalayci](https://forum.ansible.com/u/Kerem_Kalayci)\
**Post date:** [December 30, 2021, 8:16am UTC](https://forum.ansible.com/t/how-can-i-get-around-this-error/36160/1 "2021-12-30T08:16:28Z")

</div>

Hi everyone, i’m newbie at ansible yml.  
I am trying to run a command like below. But I am getting an error as below. where am i doing wrong?

- gather\_facts: False  
name: LINGO’da komut  
hosts: xxx  
remote\_user: xxx

tasks:

- name: Run basic PowerShell script  
win\_powershell:  
script: |  
C:\Users\emperior\Desktop\run\_command.ps1

ERROR! conflicting action statements: win\_powershell, script  
The error appears to be in ‘/tmp/awx\_13485\_rbw826y0/project/5-create-iso.yml’: line 10, column 7, but may  
be elsewhere in the file depending on the exact syntax problem.  
The offending line appears to be:  
tasks:

- name: Run basic PowerShell script  
^ here

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [December 30, 2021, 8:25am UTC](https://forum.ansible.com/t/how-can-i-get-around-this-error/36160/2 "2021-12-30T08:25:26Z")

</div>

> Hi everyone, i'm newbie at ansible yml.  
> I am trying to run a command like below. But I am getting an error as below. where am i doing wrong?
> 
> - gather\_facts: False  
> name: LINGO'da komut  
> hosts: xxx  
> remote\_user: xxx
> 
> tasks:  
> - name: Run basic PowerShell script  
> win\_powershell:  
> script: |  
> C:\Users\emperior\Desktop\run\_command.ps1

Looks like wrong indentation, please try this:

&nbsp;&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- name: Run basic PowerShell script  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;win\_powershell:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script: |  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C:\Users\emperior\Desktop\run\_command.ps1

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![dulhaver](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dulhaver/32/1061_2.png) [@dulhaver](https://forum.ansible.com/u/dulhaver)\
**Post date:** [December 30, 2021, 8:40am UTC](https://forum.ansible.com/t/how-can-i-get-around-this-error/36160/3 "2021-12-30T08:40:47Z")

</div>

on first sight I would try to change the indentation of the task like:

tasks:

- name: Run basic PowerShell script  
win\_powershell: |  
your script here

not 100% sure about the postition-indentation of the script line though. That said … it’s always a good idea to look at the examples from the documentation of the module you are trying to use [https://docs.ansible.com/ansible/latest/collections/ansible/windows/win\_powershell\_module.html#ansible-collections-ansible-windows-win-powershell-module](https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_powershell_module.html#ansible-collections-ansible-windows-win-powershell-module)

In this case it looks like the script parameter expects the actual script and not a link to a file.

---

<div class="post-metadata">

**Author:** ![Luca\_remix\_tj\_Lorenz](https://avatars.discourse-cdn.com/v4/letter/l/ea666f/32.png) [@Luca\_remix\_tj\_Lorenz](https://forum.ansible.com/u/Luca_remix_tj_Lorenz)\
**Post date:** [December 30, 2021, 9:53am UTC](https://forum.ansible.com/t/how-can-i-get-around-this-error/36160/4 "2021-12-30T09:53:13Z")

</div>

Hello Kerem,

you’re using a bad indentation.

win\_powershell: has to be aligned with the n of name: (the previous row)

and script as to be aligned with the n of win\_powershell.

So your playbook will result written this way:

- gather\_facts: False  
name: asdf  
hosts: localhost  
tasks:
- name: Run basic PowerShell script  
win\_powershell:  
script: |  
C:\Users\emperior\Desktop\run\_command.ps1

Luca

---

<div class="post-metadata">

**Author:** ![Kerem\_Kalayci](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@Kerem\_Kalayci](https://forum.ansible.com/u/Kerem_Kalayci)\
**Post date:** [December 30, 2021, 12:09pm UTC](https://forum.ansible.com/t/how-can-i-get-around-this-error/36160/5 "2021-12-30T12:09:44Z")

</div>

Hi Luca,

Thank you for your interest and reply. When I tried in the order you sent, I got an error like below.  
I think I’m having a problem with the module version. What is your opinion?

[https://stackoverflow.com/questions/47159193/why-does-ansible-show-error-no-action-detected-in-task-error](https://stackoverflow.com/questions/47159193/why-does-ansible-show-error-no-action-detected-in-task-error)

**ERROR! couldn’t resolve module/action ‘win\_powershell’. This often indicates a misspelling, missing collection, or incorrect module path.**  
**The error appears to be in ‘/tmp/awx\_13558\_5zugncc6/project/5-create-iso.yml’: line 5, column 5, but may**  
**be elsewhere in the file depending on the exact syntax problem.**  
**The offending line appears to be:**  
**tasks:**  
**- name: Run basic PowerShell script**  
**^ here**

30 Aralık 2021 Perşembe tarihinde saat 12:53:39 UTC+3 itibarıyla [lorenze...@gmail.com](mailto:lorenze...@gmail.com) şunları yazdı:

---

<div class="post-metadata">

**Author:** ![Luca\_remix\_tj\_Lorenz](https://avatars.discourse-cdn.com/v4/letter/l/ea666f/32.png) [@Luca\_remix\_tj\_Lorenz](https://forum.ansible.com/u/Luca_remix_tj_Lorenz)\
**Post date:** [December 30, 2021, 12:15pm UTC](https://forum.ansible.com/t/how-can-i-get-around-this-error/36160/6 "2021-12-30T12:15:09Z")

</div>

Hello,

check docs of this module. On top of the page there are some clarifications on steps you need to do:

[https://docs.ansible.com/ansible/latest/collections/ansible/windows/win\_powershell\_module.html](https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_powershell_module.html)
