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

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




> On 12/30/2021 9:16 AM Kerem Kalayci <[email protected]> wrote:
> 
> 
> 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
> 
> 
> 
> 
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> mailto:[email protected] .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/365641a3-53a5-4012-b9c2-254ebf2c433an%40googlegroups.com
>  
> https://groups.google.com/d/msgid/ansible-project/365641a3-53a5-4012-b9c2-254ebf2c433an%40googlegroups.com?utm_medium=email&utm_source=footer
>  .
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1697157443.628703.1640853647875%40office.mailbox.org.

Reply via email to