[英]How to copy a file from Linux server to Windows server using Ansible playbook
我想将一些虚拟文件从 Linux 远程服务器复制到 Windows 远程服务器,但我无法成功。 我正在使用 AWX,但 output 出现错误。
ERROR! 'win_copy' is not s valid attribute for a playbook
我用的Ansible版本是2.9.19,AWX版本是21.0.0
这是我要运行的剧本:
- name: testing windows files
hosts: {{ hostname }}
tasks:
- name: Copy a single file
win_copy:
src: /path/to/src/test.txt
dest: user@hostname.domain.name.com:C:\Temp\renamed-test.txt
我尝试使用“复制”属性,但 output 是相同的。
注意:我已经安装了 ansible.windows 模块,但没有任何变化。
温多兹很奇怪。 通常,Windoze 必须运行 WinRM。
所以首先要看你是否可以连接:
- name: testing windoze connections
hosts: all
gather_facts: no
tasks:
- name: Ping host
win_ping:
如果可行,那么您的win_copy
将是:
- name: Copy file
win_copy:
src: '/path/to/src/test.txt'
dest: 'C:\Temp\renamed-test.txt'
用户名需要在变量ansible_user
中,密码在ansible_password
中。
它看起来是语法错误。 win_copy
任务的缩进错误。 至少应正确解析以下代码:
- name: testing windows files
hosts: {{ hostname }}
tasks:
- name: Copy a single file
win_copy:
src: /path/to/src/test.txt
dest: C:\Temp\renamed-test.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.