0

I was trying to copy a test file from a Linux control server to a Windows 7 client. my playbook is

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

And getting this error

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

Any thoughts? How I can make this work?

tedder42
  • 20,195
  • 8
  • 74
  • 92

2 Answers2

1

There's a small bug in that fork version. Use https://gist.github.com/dmitrydigi/dc4843fca7e69bcca147 with the fix. If you use the mentioned version, then template will always report changed=true.

dmitrydigi
  • 13
  • 5
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