Ansible 中出现错误 '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: [10.0.151.46]: FAILED! => {"changed": false, "msg": "Could not find or access '../../package/UNI_UCS_Network_VPC_V4.1.1.tar.gz' Searched in: /root/init/sdnagent/roles/network-ovn/files/../../package/UNI_UCS_Network_VPC_V4.1.1.tar.gz /root/init/sdnagent/roles/network-ovn/../../package/UNI_UCS_Network_VPC_V4.1.1.tar.gz /root/init/sdnagent/roles/network-ovn/tasks/files/../../package/UNI_UCS_Network_VPC_V4.1.1.tar.gz /root/init/sdnagent/roles/network-ovn/tasks/../../package/UNI_UCS_Network_VPC_V4.1.1.tar.gz /root/init/sdnagent/files/../../package/UNI_UCS_Network_VPC_V4.1.1.tar.gz /root/init/sdnagent/../../package/UNI_UCS_Network_VPC_V4.1.1.tar.gz on the Ansible Controller. If you are using a module and expect the file to exist on the remote, see the remote_src option"}',错误原因是无法在远程服务器上找到或访问指定的文件'../../package/UNI_UCS_Network_VPC_V4.1.1.tar.gz'。在 Ansible 控制器上搜索了多个路径,但都没有找到该文件。

如果使用的是模块并且期望在远程服务器上存在该文件,则需要查看 remote_src 选项。remote_src 选项可以指定远程服务器上文件的路径,并确保 Ansible 在执行任务时能够找到该文件。例如:

- name: Copy file from remote server
  copy:
    src: 'remote_file.txt'
    dest: '/tmp/remote_file.txt'
    remote_src: '/path/to/remote/file.txt'

在这个例子中,remote_src 选项指定了远程服务器上文件 'remote_file.txt' 的路径。

通过使用 remote_src 选项,可以确保 Ansible 在执行任务时能够找到并访问远程服务器上的文件。

Ansible 错误:无法找到文件 'UNI_UCS_Network_VPC_V4.1.1.tar.gz' - 远程源文件解决方案

原文地址: https://www.cveoy.top/t/topic/lUbR 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录