Hi everyone,
I am already running multiple tasks using raw on my windows remote. The
patch that is mentioned in previouse posts (KB2842230) is already installed.
When I am running my playbook, I am getting the following error:
Code hier eingeben...<10.0.2.176> WINRM RESULT <Response code 0, out
"UploadFile.ps1
is ca", err "#< CLIXML <Objs Ver">
fatal: [10.0.2.176] => Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line
586, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line
789, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.
module_args, inject, port, complex_args=complex_args)
File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line
1036, in _executor_internal_inner
result = handler.run(conn, tmp, module_name, module_args, inject,
complex_args)
File
"/usr/lib/python2.7/site-packages/ansible/runner/action_plugins/raw.py",
line 47, in run
become=self.runner.become)
File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line
1174, in _low_level_exec_command
in_data=in_data)
File
"/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/winrm.py"
, line 165, in exec_command
return (result.status_code, '', result.std_out.encode('utf-8'), result.
std_err.encode('utf-8'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position 240:
ordinal not in range(128)
Can anyone tell me how I can get the full error mentioned in the WINRM
RESULT ("err "#< CLIXML <Objs Ver").
Here is my current setup:
The playbook:
- name: Upload a file to the ftp-Server.
hosts: builder
tasks:
- name: upload
raw: d:\PowershellScripts\UploadFile.ps1
My powershell script:
#we specify the directory where all files that we want to upload
$LocalFile="C:\foo.txt"
$RemoteFile = "ftp://192.168.1.50/foo.txt"
$Username = "user"
$Password = "pass"
# Create FTP Rquest Object
$FTPRequest = [System.Net.FtpWebRequest]::Create("$RemoteFile")
$FTPRequest = [System.Net.FtpWebRequest]$FTPRequest
$FTPRequest.Method = [System.Net.WebRequestMethods+Ftp]::UploadFile
$FTPRequest.Credentials = new-object System.Net.NetworkCredential($Username,
$Password)
$FTPRequest.UseBinary = $true
$FTPRequest.UsePassive = $true
# Read the File for Upload
$FileContent = gc -en byte $LocalFile
$FTPRequest.ContentLength = $FileContent.Length
# Get Stream Request by bytes
$Run = $FTPRequest.GetRequestStream()
$Run.Write($FileContent, 0, $FileContent.Length)
# Cleanup
$Run.Close()
$Run.Dispose()
Kind regards
Thorsten
--
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/71b85be4-f1f7-458d-adb1-2f198f9d7279%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.