$ ansible --version
ansible 2.10.8
config file = /Users/myUser/.ansible.cfg
configured module search path = ['/Users/myUser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/3.3.0/libexec/lib/python3.9/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.9.4 (default, Apr 5 2021, 01:50:46) [Clang 12.0.0 (clang-1200.0.32.29)]
我想将我基于 Linux 的 Ansible 主机(运行
ansible-playbook
的主机)上的文件复制到 Windows 节点。我试过了
- name: "Copy {{ local_file }} to {{ remote_dir }}"
copy:
src: "{{ local_file }}" # ~/path/file.txt
dest: "{{ remote_dir }}" # C:\\temp
remote_src: true
delegate_to: localhost
tags:
- new_install
- update
但是任务只是创建一个本地(在 Linux 节点上)
C:\\temp
文件。当我设置 remote_src: false
或只是不将其添加为选项时,我得到相同的结果。我错过了什么? TIA