Ashton
Ashton

Reputation: 63

Ansible Windows - Copying within remote

I am trying to use Ansible to copy from one location on a server to another location on the same server, e.g. "cp c:/users/foo c:/users/bar" but cannot find how to do so, or even if it is possible.

Can anyone help?

Upvotes: 1

Views: 2265

Answers (2)

Sandeep
Sandeep

Reputation: 61

Use remote_src: True

Example:

- name: Copy a single file where the source is on the remote host
  win_copy:
    src: C:\temp\foo.txt
    dest: C:\ansible\foo.txt
    remote_src: True

http://docs.ansible.com/ansible/latest/win_copy_module.html

Upvotes: 1

Sergio Bernardo
Sergio Bernardo

Reputation: 368

Use the "raw" module and send your command directelly to Powershell:

http://docs.ansible.com/ansible/raw_module.html

Despite it's description, it can be used for windows.

Sérgio

Upvotes: 0

Related Questions