更新时间:2023-08-21 09:32:46
您可以使用
You can use the synchronize
module to copy files from local to remote or from remote to local host. For example
- name: 'Copy run.sh to remote machine'
synchronize:
mode: push
src: top.sh
dest: /home/username
- name: Execute the script
command: sh /home/username/top.sh
- name: 'Copy system.txt to local machine'
synchronize:
mode: pull
src: /home/username/system.txt
dest: .
注意:要使synchronize
模块正常工作,您需要在主机上安装rsync
.
Note: for the synchronize
module to work you will need to have rsync
installed on the hosts.