fetch官方链接http://docs.ansible.com/ansible/fetch_module.html
文件拉取模块主要是将远程主机中的文件拷贝到本机中,和copy模块的作用刚刚相反,并且在保存的时候使用hostname来进行保存,当文件不存在的时候,会出现错误,除非设置了选项fail_on_missing为yes
fetch用法选项
[iyunv@ansible ~]# ansible-doc -s fetch
less 436
Copyright (C) 1984-2009 Mark Nudelman
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
- name: Fetches a file from remote nodes
action: fetch
dest= # A directory to save the file into. For example, if the `dest' directory is `/backup' a `src' file
named `/etc/profile' on host `host.example.com', would be saved
into `/backup/host.example.com/etc/profile'
fail_on_missing # Makes it fails when the source file is missing.
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.
src=\'#\'" # The file on the remote system to fetch. This `must' be a file, not a directory. Recursive
fetching may be supported in a later release.
validate_checksum # Verify that the source and destination checksums match after the files are fetched.