Glad its working.

Actually, you might be able to save yourself a step using the 'script' 
module which can deliver your powershell script to the windows hosts and 
run it with 1 module call.

- name: Configure Tentacle
  hosts: all
  tasks:
    - name: Configure Tentacle
      script: config.ps1

More examples of using script on windows in the integration tests here: 
https://github.com/ansible/ansible/blob/devel/test/integration/roles/test_win_script/tasks/main.yml

HTH

Jon

On Wednesday, 23 March 2016 16:56:11 UTC, Mark Matthews wrote:
>
> Hi Jon
>
> Thanks for your quick response!
>
> I was able to get this all working by copying a Powershell script to the 
> servers Temp wile (win_copy), and then using the 'raw' command to execute 
> that script.
>
> - name: Configure Tentacle
>   hosts: all
>   tasks:
>     - name: Configure Tentacle
>       raw: "C:\\Temp\\config.ps1"
>
> Thanks again for your help!
>
> On Wednesday, March 23, 2016 at 3:10:59 PM UTC, Mark Matthews wrote:
>>
>> Hi
>>
>>  
>>
>> Is it possible to run a the following raw command to start a PowerShell 
>> script? Neither of the below work…I keep getting errors.
>>
>>  
>>
>> - name: Config Octo
>>
>>   hosts: winservers
>>
>>   tasks:
>>
>>     - name: Config Octo
>>
>>       raw: '\\10.10.3.167\C$\Temp\octo.ps1'
>>
>>  
>>
>> or
>>
>>  
>>
>> - name: Config Octo
>>
>>   hosts: winservers
>>
>>   tasks:
>>
>>     - name: Config Octo
>>
>>       raw: //10.10.3.167/C$/Temp/octo.ps1
>>
>>  
>>
>>  
>>
>> Example of error:
>>
>> fatal: [10.10.3.169]: FAILED! => {"changed": false, "failed": true, "rc": 
>> 1, "stderr": "#< CLIXML\r\n<Objs Version=\"1.1.0.1\" xmlns=\"
>> http://schemas.microsoft.com/powershell/2004/04\ 
>> <http://schemas.microsoft.com/powershell/2004/04/>"><S S=\"Error\">&amp; 
>> : The term '\\\\10.10.3.167\\C$\\Temp\\octo.ps1' is not recognized as the 
>> name of _x000D__x000A_</S><S S=\"Error\">a cmdlet, function, script file, 
>> or operable program. Check the spelling of _x000D__x000A_</S><S 
>> S=\"Error\">the name, or if a path was included, verify that the path is 
>> correct and try _x000D__x000A_</S><S S=\"Error\">again._x000D__x000A_</S><S 
>> S=\"Error\">At line:1 char:3_x000D__x000A_</S><S S=\"Error\">+ &amp; 
>> \\\\10.10.3.167\\C$\\Temp\\octo.ps1_x000D__x000A_</S><S S=\"Error\">+   
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S S=\"Error\">    + 
>> CategoryInfo          : ObjectNotFound: (
>> \\\\10.10.3.167\\C$\\Temp\\octo.ps1: _x000D__x000A_</S><S S=\"Error\">   
>> String) [], CommandNotFoundException_x000D__x000A_</S><S S=\"Error\">    + 
>> FullyQualifiedErrorId : CommandNotFoundException_x000D__x000A_</S><S 
>> S=\"Error\"> _x000D__x000A_</S></Objs>", "stdout": "", "stdout_lines": []}
>>
>>  
>>
>>  
>>
>> The reason im trying to do it this way is because if I try get Ansible to 
>> run the PowerShell script using the 'script' module it always fails due to 
>> access rights.
>>
>>  
>>
>> So Im trying to use the ‘raw’ command to execute a PowerShell script 
>> located on a template server to run on target server.
>>
>>  
>>
>>  
>>
>> Cheers
>>
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ea30e500-ffdc-4489-880a-7cb176c2c7e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to