It appears that the only way to copy or move files on remote Windows 
Servers requires the use of
the raw module (or uploading your own PS script). However, I can't get even 
a basic move to work.

- name: Configure the Windows Server 2012 R2 instance
  hosts: ec2hosts
  vars:
    workdirectory: 'C:\mystuff'

- name: move config file
  raw: move /y {{ workdirectory }}\config\junk.conf {{ workdirectory }}\
config\smtp.conf


When this executes, I get this response:

TASK [move config file] **********************************************
task path: /Users/me/build_win.yml:99
<52.xx.xx.xx> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 
5986 TO 52.xx.xx.xx
<52.xx.xx.xx> EXEC move /y C:\mystuff\config\junk.conf C:\mystuff\config\
smtp.conf
fatal: [52.xx.xx.xx]: FAILED! => {"changed": false, "failed": true, 
"invocation": {"module_args": {"_raw_params": "move /y 
C:\\mystuff\\config\\junk.conf C:\\mystuff\\config\\smtp.conf"}, 
"module_name": "raw"}, "rc": 1, "stderr": "#< CLIXML\r\n<Objs 
Version=\"1.1.0.1\" 
xmlns=\"http://schemas.microsoft.com/powershell/2004/04\";><S 
S=\"Error\">Move-Item : A positional parameter cannot be found that accepts 
argument _x000D__x000A_</S><S 
S=\"Error\">'C:\\mystuff\\config\\smtp.conf'._x000D__x000A_</S><S 
S=\"Error\">At line:1 char:1_x000D__x000A_</S><S S=\"Error\">+ move /y 
_x000D__x000A_</S><S S=\"Error\">C:\\mystuff\\config\\smtp.conf 
..._x000D__x000A_</S><S S=\"Error\">+ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S
 
S=\"Error\">~~~_x000D__x000A_</S><S S=\"Error\">    + CategoryInfo         
 : InvalidArgument: (:) [Move-Item], ParameterBindi _x000D__x000A_</S><S 
S=\"Error\">   ngException_x000D__x000A_</S><S S=\"Error\">    + 
FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell 
_x000D__x000A_</S><S S=\"Error\">   
.Commands.MoveItemCommand_x000D__x000A_</S><S S=\"Error\"> 
_x000D__x000A_</S></Objs>", "stdout": "", "stdout_lines": []}

Note that if I go to the Windows Server and paste in the command:

move /y C:\mystuff\config\junk.conf C:\mystuff\config\smtp.conf

..it works fine.

The PS error message above:

Move-Item : A positional parameter cannot be found that accepts argument 
_x000D__x000A_

..seems to be saying there is a problem with a cr/lf ?

I'm stumped....


-- 
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/cec7306c-7112-4ff8-913e-5f45fd8bae7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to