简体   繁体   English

Ansible 无法使用 UNC Choco 源安装 Chocolatey 包

[英]Ansible cannot install Chocolatey Packages using UNC Choco source

Ansible Version: 2.4.2.0

Ansible Control: Centos7

Target Hosts: Windows 2012R2

I have a File Server named: FILESERVER and I have placed all chocolatey packages in folder C:\\Packages .我有一个名为: FILESERVER的文件服务器,我已将所有chocolatey包放在文件夹C:\\Packages And this folder is shared, so other servers can access this folder via UNC path: \\\\FILESERVER\\Packages .此文件夹是共享的,因此其他服务器可以通过 UNC 路径访问此文件夹: \\\\FILESERVER\\Packages

If I login to one of the machines and run:如果我登录其中一台机器并运行:

choco install 7zip -y -s \\FILESERVER\Packages

it goes ahead to that file server and installs the package.它继续到该文件服务器并安装该软件包。 However, if I try this via Ansible it says the package does not exists in Choco Source.但是,如果我通过Ansible尝试此Ansible它会说 Choco Source 中不存在该包。

---
- hosts: win
  tasks:
    - name: chocolatey-core.extension
      win_chocolatey:
        name: chocolatey-core.extension
        state: present
        source: \\FILESERVER\Packages

Error:错误:

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."]}

I am not sure if the ansible error message is confusing with \\\\\\\\Fileserver\\\\Package UNC path?我不确定 ansible 错误消息是否与\\\\\\\\Fileserver\\\\Package UNC 路径混淆? or is it actually using that \\\\\\\\FileServer\\\\Packages as actualy Choco Source?或者它实际上使用\\\\\\\\FileServer\\\\Packages作为实际的 Choco Source?

It might be possible that ansible via WinRM cannot access the net share because it runs in a different context.可能通过 WinRM 的 ansible 无法访问网络共享,因为它在不同的上下文中运行。

See https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html#limitations for limitations.有关限制,请参阅https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html#limitations

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM