win_chocolatey issue

I’m not sure if this is a win_chocolatey issue, or an issue with the maintainers of the chocolatey installation (using Ansible 2.4.1.0)

However, I’m having issues with installing git.install using win_chocolatey (when I have a long list of chocolatey packages to install)…

  • name: win | Install chocolatey components

win_chocolatey:

name: “{{ item.package_name }}”

allow_empty_checksums: yes

with_items: “{{ chocolately_packages }}”

become_method: runas

chocolately_packages:

  • package_name: git.install

  • package_name: visualstudio2017buildtools

  • package_name: visualstudio2017-workload-vctools

with the error being:

vsphere: “Using Git LFS”,
vsphere: “Installing 64-bit git.install…”,
vsphere: “git.install has been installed.”,
vsphere: “VERBOSE: Trying local and machine (x32 & x64) Uninstall keys”,
vsphere: “VERBOSE: Retrieving all uninstall registry keys”,
vsphere: “VERBOSE: Trying Uninstall key property ‘InstallLocation’”,
vsphere: “git.install installed to ‘C:\Program Files\Git’”,
vsphere: “ERROR: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Access is denied”,
vsphere: " git.install can be automatically uninstalled.“,
vsphere: “Environment Vars (like PATH) have changed. Close/reopen your shell to”,
vsphere: " see the changes (or in powershell/cmd.exe just type refreshenv).”,
vsphere: “git.install not installed. An error occurred during installation:”,
vsphere: " Access to the path ‘C:\ProgramData\chocolatey\lib\git.install\tools\Git-2.15.0-64-bit.exe’ is denied.",
vsphere: “The process cannot access the file ‘C:\ProgramData\chocolatey\lib\git.install\.chocolateyPending’ because it is being used by another process.”
vsphere: ],
vsphere: “command”: “choco.exe install -v --no-progress -y git.install --timeout 2700 --failonunfound --allow-empty-checksums”,
vsphere: “failed”: true,
vsphere: “item”: {
vsphere: “package_name”: “git.install”
vsphere: },
vsphere: “msg”: “Error installing package ‘git.install’”,
vsphere: “rc”: 1,

Is this an issue with the package itself or something to do with win_chocolatey?

What’s weird is that it sometimes does work without any issues 1 out of 10 times…