我想从Linux远程服务器复制一些虚拟文件到Windows远程服务器,但我无法成功。我正在使用AWX,但输出抛出错误。
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:Temprenamed-test.txt
我试着用"copy"属性,但输出是相同的。
注意:我已经安装了ansible。Windows模块,但没有改变。
看起来是语法错误。缩进是错误的win_copy
任务。至少应该正确解析以下代码:
- name: testing windows files
hosts: {{ hostname }}
tasks:
- name: Copy a single file
win_copy:
src: /path/to/src/test.txt
dest: C:Temprenamed-test.txt
窗口很奇怪。通常,windows必须运行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:Temprenamed-test.txt'
用户名需要在ansible_user
变量中,密码需要在ansible_password
变量中。