可以将文件从一个vm(windows)复制到另一个带有ansible的vm(windows)
- script: test.ps1
Z:是网络地图 copy z:\ PROGRA~1 \ test \ File.txt C:\ Users \ file.txt
failed with error:
changed: [{{ host1 }}] => {"changed": true, "rc": 0, "stderr": "copy : Cannot fi
nd drive. A drive with the name z does not exist.\r\nAt C:\\Users\\vagrant\\AppD
ata\\Local\\Temp\\ansible-tmp-1427807499.79-10385112351761\r\n7\\test.ps1:1 char
:1\r\n+ copy z:\\PROGRA~1\\DyadicSec\\ssl\\192.168.50.13.cert C:\\Users\\192.168
.50.12.cert\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: (z:String) [Copy
-Item], DriveNot \r\n FoundException\r\n + FullyQualifiedErrorId : DriveNot
Found,Microsoft.PowerShell.Commands.Copy \r\n ItemCommand\r\n \r\n", "stdout":
""}
如果我在vm上运行ps1它的工作正常
答案 0 :(得分:0)
我猜是没有安装驱动程序。
$ echo -e 'copy : Cannot find drive. A drive with the name 'z' does not exist.\r\nAt C:\\Users\\vagrant\\AppData\\Local\\Temp\\ansible-tmp-1427807499.79-10385112351761\r\n7\\test.ps1:1 char:1\r\n+ copy z:\\PROGRA~1\\DyadicSec\\ssl\\192.168.50.13.cert C:\\Users\\192.168.50.12.cert\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: (z:String) [Copy-Item], DriveNot \r\n FoundException\r\n + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.Copy \r\n ItemCommand\r\n \r\n'
copy : Cannot find drive. A drive with the name z does not exist.
At C:\Users\vagrant\AppData\Local\Temp\ansible-tmp-1427807499.79-10385112351761
7\test.ps1:1 char:1
+ copy z:\PROGRA~1\DyadicSec\ssl\192.168.50.13.cert C:\Users\192.168.50.12.cert
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (z:String) [Copy-Item], DriveNot
FoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.Copy
ItemCommand
$