Ansible 拷贝文件到目标机器:简单指南
要使用 Ansible 从控制机拷贝文件到目标机器,可以使用 Ansible 的 'copy' 模块。以下是一个示例任务:
- name: Copy file to target machine
hosts: target
tasks:
- name: Copy file
copy:
src: '/path/to/source/file'
dest: '/path/to/destination/file'
在上述示例中,'hosts' 指定了目标机器的主机组,'src' 指定了控制机上要拷贝的源文件路径,'dest' 指定了目标机器上拷贝后的目标文件路径。
执行该任务时,Ansible 会将源文件拷贝到目标机器上指定的目标路径。
原文地址: https://www.cveoy.top/t/topic/qfAh 著作权归作者所有。请勿转载和采集!