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)
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,
What's weird is that it sometimes does work without any issues 1 out of 10 times...