Dilshad Abduwali
Dilshad Abduwali

Reputation: 1458

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. And this folder is shared, so other servers can access this folder via UNC path: \\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.

---
- 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? or is it actually using that \\\\FileServer\\Packages as actualy Choco Source?

Upvotes: 0

Views: 764

Answers (1)

ibotty
ibotty

Reputation: 739

It might be possible that ansible via WinRM cannot access the net share because it runs in a different context.

See https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html#limitations for limitations.

Upvotes: 0

Related Questions