我将文件从Ansible Master复制到Windows Machine时遇到问题。 当我直接从Master机器上运行剧本时,没有任何问题,但是,当从AWX中执行同一剧本时,我遇到了问题
代码:
---
- name: Creating test folder and copy
hosts: all
tasks:
- name: Create TEST folder
win_file:
path: C:\TEST
state: directory
- name: Set ACL for TEST folder
win_acl:
path: C:\TEST
user: Administrators
rights: FullControl
type: allow
state: present
- name: Copy a test1 to TEST folder
win_copy:
src: /etc/files/test1
dest: C:\test\
local_follow: yes
remote_src: no
在AWX中执行时得到:
SSH password:
PLAY [Creating TEST folder and copy] *********************
TASK [Gathering Facts] *********************
ok: [WEAZ2170RP02]
TASK [Create TEST folder] *********************
ok: [WEAZ2170RP02]
TASK [Set ACL for TEST folder] *********************
ok: [WEAZ2170RP02]
TASK [Copy a test1 to TEST folder] *********************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [WEAZ2170RP02]: FAILED! => {"changed": false, "dest": "C:\\TEST\\", "msg": "Could not find or access '/etc/files/test1' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option", "src": "/etc/files/test1"}
PLAY RECAP *******************
WEAZ2170RP02 : ok=3 changed=0 unreachable=0 failed=1
test1上的Chmod 777
我也尝试了win_copy的参数: local_follow:否
但是没有运气 remote_src:否
尝试了不同的路径,例如/ tmp / test1
AWX可能有一些不同之处,但我找不到它,累了十几种变体,但它们都不起作用