No, but it looks like you're trying to use the Python "command" module to 
exec the script. On Ansible 2.1, use raw or the script module (if the 
script lives on the control host and you want to push it over). In 
devel/2.2+ you can use win_shell or win_command, but those modules are new 
to the (yet-to-be-released) Ansible 2.2.

On Thursday, September 15, 2016 at 7:25:45 PM UTC-7, Mumshad Mannambeth 
wrote:
>
> I am trying to run a basic script on a windows host using ansible. 
>
> Why is it looking for Python on windows? Do we need to have Python 
> installed on windows to run a script? :
>
>
>
>
> TASK [setup] 
> *******************************************************************
> <10.xx.xx.108> ESTABLISH WINRM CONNECTION FOR USER: administrator on PORT 
> 5986 TO 10.xx.xx.108
> <10.xx.xx.108> EXEC Set-StrictMode -Version Latest
> (New-Item -Type Directory -Path $env:temp -Name 
> "ansible-tmp-1473989964.43-210051997727769").FullName | Write-Host 
> -Separator '';
> <10.xx.xx.108> PUT "/tmp/tmpNkeo10" TO 
> "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1473989964.43-210051997727769\setup.ps1"
> <10.xx.xx.108> EXEC Set-StrictMode -Version Latest
> Try
> {
> & 
> 'C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1473989964.43-210051997727769\setup.ps1'
> }
> Catch
> {
> $_obj = @{ failed = $true }
> If ($_.Exception.GetType)
> {
> $_obj.Add('msg', $_.Exception.Message)
> }
> Else
> {
> $_obj.Add('msg', $_.ToString())
> }
> If ($_.InvocationInfo.PositionMessage)
> {
> $_obj.Add('exception', $_.InvocationInfo.PositionMessage)
> }
> ElseIf ($_.ScriptStackTrace)
> {
> $_obj.Add('exception', $_.ScriptStackTrace)
> }
> Try
> {
> $_obj.Add('error_record', ($_ | ConvertTo-Json | ConvertFrom-Json))
> }
> Catch
> {
> }
> Echo $_obj | ConvertTo-Json -Compress -Depth 99
> Exit 1
> }
> Finally { Remove-Item 
> "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1473989964.43-210051997727769"
>  
> -Force -Recurse -ErrorAction SilentlyContinue }
> ok: [web_server_node1] => {"ansible_facts": {"ansible_architecture": 
> "64-bit", "ansible_date_time": {"date": "9/15/2016", "day": "15", "hour": 
> "21", "iso8601": "2016-09-15T21:37:56", "minute": "37", "month": "09", 
> "year": "2016"}, "ansible_distribution": "Microsoft Windows NT 6.3.9600.0", 
> "ansible_distribution_version": "6.3.9600.0", "ansible_env": 
> {"ALLUSERSPROFILE": "C:\\ProgramData", "APPDATA": 
> "C:\\Users\\Administrator\\AppData\\Roaming", "COMPUTERNAME": "LGLAS108", 
> "ComSpec": "C:\\Windows\\system32\\cmd.exe", "CommonProgramFiles": 
> "C:\\Program Files\\Common Files", "CommonProgramFiles(x86)": "C:\\Program 
> Files (x86)\\Common Files", "CommonProgramW6432": "C:\\Program 
> Files\\Common Files", "FP_NO_HOST_CHECK": "NO", "HOMEDRIVE": "C:", 
> "HOMEPATH": "\\Users\\Administrator", "LOCALAPPDATA": 
> "C:\\Users\\Administrator\\AppData\\Local", "LOGONSERVER": "\\\\LGLAS108", 
> "MODULE_COMPLEX_ARGS": "{\"_ansible_version\": \"2.1.1.0\", 
> \"_ansible_selinux_special_fs\": [\"fuse\", \"nfs\", \"vboxsf\", 
> \"ramfs\"], \"_ansible_no_log\": false, \"_ansible_verbosity\": 3, 
> \"_ansible_syslog_facility\": \"LOG_USER\", \"gather_subset\": \"all\", 
> \"_ansible_diff\": false, \"_ansible_debug\": false, 
> \"_ansible_check_mode\": false}", "NUMBER_OF_PROCESSORS": "2", "OS": 
> "Windows_NT", "PATHEXT": 
> ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL", 
> "PROCESSOR_ARCHITECTURE": "AMD64", "PROCESSOR_IDENTIFIER": "Intel64 Family 
> 6 Model 26 Stepping 4, GenuineIntel", "PROCESSOR_LEVEL": "6", 
> "PROCESSOR_REVISION": "1a04", "PROMPT": "$P$G", 
> "PSExecutionPolicyPreference": "Unrestricted", "PSModulePath": 
> "C:\\Users\\Administrator\\Documents\\WindowsPowerShell\\Modules;C:\\Program 
> Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules",
>  
> "PUBLIC": "C:\\Users\\Public", "Path": 
> "C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0",
>  
> "ProgramData": "C:\\ProgramData", "ProgramFiles": "C:\\Program Files", 
> "ProgramFiles(x86)": "C:\\Program Files (x86)", "ProgramW6432": 
> "C:\\Program Files", "SystemDrive": "C:", "SystemRoot": "C:\\Windows", 
> "TEMP": "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp", "TMP": 
> "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp", "USERDOMAIN": "LGLAS108", 
> "USERDOMAIN_ROAMINGPROFILE": "LGLAS108", "USERNAME": "Administrator", 
> "USERPROFILE": "C:\\Users\\Administrator", "windir": "C:\\Windows"}, 
> "ansible_fqdn": "lglas108.ehcdomain2.local", "ansible_hostname": 
> "LGLAS108", "ansible_interfaces": [{"default_gateway": "10.247.69.1", 
> "dns_domain": null, "interface_index": 12, "interface_name": "Intel(R) 
> 82574L Gigabit Network Connection"}], "ansible_ip_addresses": 
> ["10.xx.xx.108", "fe80::3451:3c97:517b:5c87"], "ansible_lastboot": 
> "2016-09-15 19:37:51Z", "ansible_os_family": "Windows", "ansible_os_name": 
> "Microsoft Windows Server 2012 R2 Standard Evaluation", 
> "ansible_powershell_version": 4, "ansible_system": "Win32NT", 
> "ansible_totalmem": 4294500352, "ansible_uptime_seconds": 7205, 
> "ansible_win_rm_certificate_expires": "2017-09-15 20:26:34"}, "changed": 
> false, "invocation": {"module_name": "setup"}}
> task path: /opt/ehc-ansible-projects/EHC40/test.yml:24
>
> TASK [run pwoershell script] 
> ***************************************************
> <10.xx.xx.108> ESTABLISH WINRM CONNECTION FOR USER: administrator on PORT 
> 5986 TO 10.xx.xx.108
> <10.xx.xx.108> EXEC Set-StrictMode -Version Latest
> (New-Item -Type Directory -Path $env:temp -Name 
> "ansible-tmp-1473989967.21-182746111595233").FullName | Write-Host 
> -Separator '';
> <10.xx.xx.108> PUT "/tmp/tmpBj6PDQ" TO 
> "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1473989967.21-182746111595233\command.ps1"
> <10.xx.xx.108> EXEC Set-StrictMode -Version Latest
> Try
> {
> /usr/bin/python 
> 'C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1473989967.21-182746111595233\command.ps1'
> }
> Catch
> {
> $_obj = @{ failed = $true }
> If ($_.Exception.GetType)
> {
> $_obj.Add('msg', $_.Exception.Message)
> }
> Else
> {
> $_obj.Add('msg', $_.ToString())
> }
> If ($_.InvocationInfo.PositionMessage)
> {
> $_obj.Add('exception', $_.InvocationInfo.PositionMessage)
> }
> ElseIf ($_.ScriptStackTrace)
> {
> $_obj.Add('exception', $_.ScriptStackTrace)
> }
> Try
> {
> $_obj.Add('error_record', ($_ | ConvertTo-Json | ConvertFrom-Json))
> }
> Catch
> {
> }
> Echo $_obj | ConvertTo-Json -Compress -Depth 99
> Exit 1
> }
> Finally { Remove-Item 
> "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1473989967.21-182746111595233"
>  
> -Force -Recurse -ErrorAction SilentlyContinue }
> An exception occurred during task execution. The full traceback is:
> At line:4 char:1 
> + /usr/bin/python 
> 'C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-147398996 ... 
> + ~~~~~~~~~~~~~~~
> fatal: [web_server_node1]: FAILED! => {"changed": false, "failed": true, 
> "invocation": {"module_name": "command"}, "msg": "The term 
> '/usr/bin/python' is not recognized as the name of a cmdlet, function, 
> script file, or operable program. Check the spelling of the name, or if a 
> path was included, verify that the path is correct and try again."}
>
>

-- 
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/0881bd23-277d-4c14-bfdc-cf4c32747ac7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to