Ansible Version: 2.4.2.0
Ansible Control: Centos7
Target Hosts: Windows 2012R2
我有一个名为FILESERVER
的文件服务器,并且已将所有chocolatey
包放在文件夹C:\Packages
中。并且此文件夹是共享的,因此其他服务器可以通过UNC路径\\FILESERVER\Packages
访问此文件夹。
如果我登录其中一台计算机并运行:
choco install 7zip -y -s \\FILESERVER\Packages
它将继续到该文件服务器并安装软件包。但是,如果我通过Ansible
尝试此操作,则表明该软件包在Choco Source中不存在。
---
- hosts: win
tasks:
- name: chocolatey-core.extension
win_chocolatey:
name: chocolatey-core.extension
state: present
source: \\FILESERVER\Packages
错误:
fatal: [mdb]: FAILED! => {"changed": false, "choco_error_cmd": "choco.exe install -r --no-progress -y chocolatey-core.extension --timeout 2700 --failonunfound --source \\\\FILESERVER\\Packages", "choco_error_log": ["Installing the following packages:", "chocolatey-core.extension", "By installing you accept licenses for the packages.", "chocolatey-core.extension not installed. The package was not found with the source(s) listed.", " Source(s): '\\\\FILESERVER\\Packages'", " NOTE: When you specify explicit sources, it overrides default sources.", "If the package version is a prerelease and you didn't specify `--pre`,", " the package may not be found.", "Please see http s://chocolatey.org/docs/troubleshooting for more ", " assistance.", "","Chocolatey installed 0/1 packages. 1 packages failed.", " See the log for details (C:\\ProgramData\\chocolatey\\logs\\chocolatey.log).", "", "Failures", " - chocolatey-core.extension - chocolatey-coree.extension not installed. The package was not found with the source(s) listed.", " Source(s): '\\\\FILESERVER\\Packages'", " NOTE: When you specify explicit sources, it overrides default sources.", "If the package version is a prerelease and you didn't specify `--pre `,", " the package may not be found.", "Please see https://chocolatey.org/docs/troubleshooting for more ", " assistance."], "command": "choco.exe install -r --no-progress -y chocolatey-core.extension --timeout 2700 --failonunfound --source \\\\FILESERVER\\Packages", "msg": "Error installing package 'chocolatey-core.extension'", "rc": 1, "stdout": "Installing the following packages:\r\nchocolatey-core.extension\r\nBy installing you accept licenses for the packages.\r\nchocolatey-core.extension not installed. The package was not found with the source(s) listed.\r\n Source(s): \\\\FILESERVER\\Packages'\r\n NOTE: When you specify explicit sources, it overrides default sources.\r\nIf the package version is a prerelease and you didn't specify `--pre`,\r\n the package may not be found.\r\nPlease see https://chocolatey.org/docs/troubleshooting for more \r\n assistance.\r\n\r\nChocolatey installed 0/1 packages. 1 packages failed.\r\n See the log for details (C:\\ProgramData\\chocolatey\\logs\\chocolatey.log).\r\n\r\nFailures\r\n - chocolatey-core.extension - chocolatey-core.extension not installed. The package was not found with the source(s) listed.\r\n Source(s): '\\\\FILESERVER\\Packages'\r\n NOTE: When you specify explicit sources, it overrides default sources.\r\nIf the package version is a prerelease and you didn't specify `--pre`,\r\n the package may not be found.\r\nPlease see https://chocolatey.org/docs/troubleshooting for more \r\n assistance.\r\n", "stdout_lines": ["Installing the following packages:", "chocolatey-core.extension", "By installing you accept licenses for the packages.", "chocolatey-core.extension not installed. The package was not found with the source(s) listed.", " Source(s): '\\\\FILESERVER\\Packages'", " NOTE: When you specify explicit sources, it overrides default sources.", "If the package version is a prerelease and you didn't specify `--pre`,", " the package may not be found.", "Please see https://chocolatey.org/docs/troubleshooting for more ", " assistance.", "","Chocolatey installed 0/1 packages. 1 packages failed.", " See the log for details (C:\\ProgramData\\chocolatey\\logs\\chocolatey.log).", "", "Failures", " - chocolatey-core.extension - chocolatey-core.extension not installed. The package was not found with the source(s) listed.", " Source(s): '\\\\FILESERVER\\Packages'", " NOTE: When you specify explicit sources, it overrides default sources.", "If the package version is a prerelease and you didn't specify `--pre`,", " the package may not be found.", "Please see https://chocolatey.org/docs/troubleshooting for more ", " assistance."]}
我不确定ansible错误消息是否与\\\\Fileserver\\Package
UNC路径混淆?还是实际上将\\\\FileServer\\Packages
用作Choco来源?
答案 0 :(得分:0)
由于Ansible通过WinRM运行在不同的上下文中,因此可能无法访问网络共享。
有关限制,请参见https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html#limitations。