Control node:

   - CentOS 7
   - Ansible 2.1
   
Remote node:

   - Windows 7
   - Powershell 3.0
   

I have a powershell script (warning.ps1) on my remote node that runs fine 
when I double click on it.  I also have a copy of the powershell script in 
my control node playbook directory.  As I understand, the following play 
ought to run the powershell script







*---- name: test warning  hosts: windows  tasks:  - name: warning    
script: warning.ps1*


Here's what I get when I run the playbook...























*[ansmgr@dhcp1-60-20 playbooks]$ ansible-playbook warning_powershell.yml 
-vvvvNo config file found; using defaultsLoaded callback default of type 
stdout, v2.0PLAYBOOK: warning_powershell.yml 
***********************************************1 plays in 
warning_powershell.ymlPLAY [test warning] 
************************************************************TASK [warning] 
*****************************************************************task path: 
/etc/ansible/playbooks/warning_powershell.yml:6<ADS-6999> ESTABLISH WINRM 
CONNECTION FOR USER: ansibleAdmin on PORT 5985 TO ADS-6999<ADS-6999> EXEC 
Set-StrictMode -Version Latest(New-Item -Type Directory -Path $env:temp 
-Name "ansible-tmp-1463494972.72-265383630304564").FullName | Write-Host 
-Separator '';<ADS-6999> PUT "/etc/ansible/playbooks/warning.ps1" TO 
"C:\Users\ansibleAdmin\AppData\Local\Temp\ansible-tmp-1463494972.72-265383630304564\warning.ps1"<ADS-6999>
 
EXEC &  
'C:\Users\ansibleAdmin\AppData\Local\Temp\ansible-tmp-1463494972.72-265383630304564\warning.ps1'<ADS-6999>
 
EXEC Set-StrictMode -Version LatestRemove-Item 
"C:\Users\ansibleAdmin\AppData\Local\Temp\ansible-tmp-1463494972.72-265383630304564"
 
-Force -Recurse;changed: [ADS-6999] => {"changed": true, "invocation": 
{"module_args": {"_raw_params": "warning.ps1"}, "module_name": "script"}, 
"rc": 0, "stderr": "", "stdout": "", "stdout_lines": []}PLAY RECAP 
*********************************************************************ADS-6999   
                
: ok=1    changed=1    unreachable=0    failed=0  *


It seems like the script is getting copied to a temporary directory but is 
not executing.  I have also tried using raw: but that doesn't work either 
and I'd prefer to use script:

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7e0902a5-94a3-4445-8374-15b3c7fd17a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to