W3cubDocs

/Ansible

win_copy - Copies files to remote locations on windows hosts.

New in version 1.9.2.

Synopsis

The win_copy module copies a file on the local box to remote windows locations.

Options

parameter required default choices comments
dest
yes
Remote absolute path where the file should be copied to. If src is a directory, this must be a directory too. Use \ for path separators.
src
no
Local path to a file to copy to the remote server; can be absolute or relative. If path is a directory, it is copied recursively. In this case, if path ends with "/", only inside contents of that directory are copied to destination. Otherwise, if it does not end with "/", the directory itself with all contents is copied. This behavior is similar to Rsync.

Examples

# Copy a single file
- win_copy: src=/srv/myfiles/foo.conf dest=c:\TEMP\foo.conf

# Copy the contents of files/temp_files dir into c: emp\.  Includes any sub dirs under files/temp_files
# Note the use of unix style path in the dest.
# This is necessary because \ is yaml escape sequence
- win_copy: src=files/temp_files/ dest=c:/temp/

# Copy the files/temp_files dir and any files or sub dirs into c:   emp
# Copies the folder because there is no trailing / on 'files/temp_files'
- win_copy: src=files/temp_files dest=c:/temp/

Return Values

Common return values are documented here Common Return Values, the following are the fields unique to this module:

name description returned type sample
src source file used for the copy on the target machine changed string /home/httpd/.ansible/tmp/ansible-tmp-1423796390.97-147729857856000/source
original_basename basename of the copied file changed (single files only) string foo.txt
dest destination file/path changed string c:/temp/
checksum sha1 checksum of the file after running copy success string 6e642bb8dd5c2e027bf21dd923337cbb4214f827
operation whether a single file copy took place or a folder copy changed (single files only) string file_copy
size size of the target, after execution changed (single files only) int 1220

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/win_copy_module.html