ansible win_copy 不起作用“错误:src 文件不存在"; [英] ansible win_copy does not work "error: src file does not exist"

查看:29
本文介绍了ansible win_copy 不起作用“错误:src 文件不存在";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用以下剧本将 mp3 文件复制到 D:\

I try to use the following playbook to copy a mp3 file to D:\

- name: copy file
  hosts: windows
  - name: copy file to D:
    win_copy:
      src: X:\assets\audio.mp3
      dest: D:\template\
      remote_src: yes

但我收到以下错误消息:

but I get the following error message:

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 控制机的共享文件.

I'm sure file X:\\assets\\audio.mp3 exists, and X:\ is a shared file of the linux control machine.

可以在这个目录structor中看到src文件当我上传 Windows 机器并运行

you can see the src file in this directory structor When I upload the windows machine and run

copy X:\assets\audio.mp3 D:\template\

在cmd.exe中,可以成功复制audio.mp3!我也尝试在windows机器上复制另一个文件,例如:

in the cmd.exe, the audio.mp3 can successfully be copied! I also tried to copy another file on the windows machine, for example:

- name: copy file
  hosts: windows
  - name: copy template to D:
    win_copy:
      src: D:\document\test.txt
      dest: D:\template\
      remote_src: yes

此任务可以成功运行!

我尝试了其他方式,例如

And I tried other way, for example

- name: copy file
  hosts: windows
  - name: copy template to D:
    win_command: cmd.exe /k copy X:\assets\audio.mp3 D:\template\

没有错误,但是我无法获取复制的文件!这真的让我分心!

there is no error, but I can't get the copied file! This really distract me!

推荐答案

移除

remote_src: true

这一行正在检查您的客户端计算机上的文件.

This line is checking for the file on your client machine .

这篇关于ansible win_copy 不起作用“错误:src 文件不存在";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆