0

我试图将测试文件从 Linux 控制服务器复制到 Windows 7 客户端。我的剧本是

- name: Test Copy from Linux to Windows
  hosts: Windows
  gather_facts: false
  tasks:
    - name: Copy
      copy: src=/tmp/tmp.txt dest=C:\Ansible

并得到这个错误

failed: [10.8.0.4] => {"failed": true, "md5sum": "c9566265d534d0e3c666ea52daf96cc8", "parsed": false}
invalid output was: The argument 'C:\Users\me.HOMEPC\AppData\Local\Temp\ansible-tmp-1422383762.86-109261083693479\\copy.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.


FATAL: all hosts have already failed -- aborting

有什么想法吗?我怎样才能使这项工作?

4

2 回答 2

1

该分叉版本中有一个小错误。使用https://gist.github.com/dmitrydigi/dc4843fca7e69bcca147进行修复。如果您使用提到的版本,那么模板将始终报告 changed=true。

于 2015-06-06T15:23:53.440 回答
0

Looks like the copy module doesn't support for file copy function in Windows and atm, a win_copy module is in the dev phase.

However I have found this VERY useful module which is copy.ps1

https://gist.github.com/tkinz27/fd92ba9af0e0309614ee

And then things got working :-)

Important: You gotta upgrade your Windows (7) Powershell to Version 4.0

于 2015-01-27T19:30:22.660 回答