ansible中如何通过copy模块复制目录下所有文件到远程主机目录请举例
可以使用ansible的copy模块结合通配符来复制目录下的所有文件到远程主机目录。具体操作如下:
例如将本地目录/local/path/to/dir下的所有文件复制到远程主机的目录/remote/path/to/dir下:
- name: Copy files from local to remote
copy:
src: "/local/path/to/dir/*"
dest: "/remote/path/to/dir/"
其中,src参数使用了通配符*来匹配目录下的所有文件。
原文地址: https://www.cveoy.top/t/topic/Em8 著作权归作者所有。请勿转载和采集!