【发布时间】:2018-07-13 03:57:58
【问题描述】:
我尝试使用以下 playbook 将 mp3 文件复制到 D:\
- name: copy file
hosts: windows
- name: copy file to D:
win_copy:
src: X:\assets\audio.mp3
dest: D:\template\
remote_src: yes
但我收到以下错误消息:
TASK [Gathering Facts]**********************************************
ok: [111.111.23.40]
TASK [copy file to D:] ********************************
fatal: [111.231.76.40]: FAILED! => {"changed": false, "dest":
"D:\\template\\", "msg": "Cannot copy src file: 'X:\\assets\\audio.mp3'
as it does not exist", "src": "X:\\assets\\audio.mp3"}
我确定文件X:\\assets\\audio.mp3存在,X:\是linux中控机的共享文件。
you can see the src file in this directory structor 当我上传windows机器并运行时
copy X:\assets\audio.mp3 D:\template\
在cmd.exe中,可以成功复制audio.mp3!我还尝试在windows机器上复制另一个文件,例如:
- name: copy file
hosts: windows
- name: copy template to D:
win_copy:
src: D:\document\test.txt
dest: D:\template\
remote_src: yes
此任务可以成功运行!
我尝试了其他方式,例如
- name: copy file
hosts: windows
- name: copy template to D:
win_command: cmd.exe /k copy X:\assets\audio.mp3 D:\template\
没有错误,但我无法获取复制的文件!这真的让我分心!
【问题讨论】:
-
检查您的文件权限。如果您的 mp3 文件和父目录具有正确的权限。您也可以使用 -vvvv 命令以详细模式运行 ansible
标签: ansible