This module works like M(copy), but in reverse. It is used for fetching files from remote machines and storing them locally in a file tree, organized by hostname. Note that this module is written to transfer log files that might not be present, so a missing remote file won't be an error unless fail_on_missing is set to 'yes'.


src The file on the remote system to fetch. This I(must) be a file, not a directory. Recursive fetching may be supported in a later release. true
dest 1. directory to save the file into. For example, if the I(dest) directory is C(/backup) a I(src) file named C(/etc/profile) on host C(, would be saved into C(/backup/ true
fail_on_missing Makes it fails when the source file is missing.
  • yes
  • no
validate_checksum Verify that the source and destination checksums match after the files are fetched.
  • yes
  • no
flat Allows you to override the default behavior of appending hostname/path/to/file to the destination. If dest ends with '/', it will use the basename of the source file, similar to the copy module. Obviously this is only handy if the filenames are unique.


Ansible Core Team ,Michael DeHaan