Chocolatey and installing GIT

Hi guys,

I am trying to install git with chocolatey using a playbook:

  • name: Install GIT

win_chocolatey:

name: git

state: present

It should be really simple when I run this. It should go through and no issues.

Although this gets quite tricky.

I get the following error when running this:

“stdout_lines”: [

“Installing the following packages:”,

“git”,

“By installing you accept licenses for the packages.”,

“”,

“git.install v2.23.0 [Approved]”,

“git.install package files install completed. Performing other installation steps.”,

“Using Git LFS”,

“Installing 64-bit git.install…”,

“WARNING: User (you) cancelled the installation.”,

“ERROR: Running ["C:\ProgramData\chocolatey\lib\git.install\tools\Git-2.23.0-64-bit.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /NOCANCEL /SP- /LOG /COMPONENTS="icons,assoc,assoc_sh,ext,ext\shellhere,ext\guihere,gitlfs,icons\quicklaunch" ] was not successful. Exit code was ‘5’. Exit code indicates the following: User (you) cancelled the installation…”,

“git not installed. An error occurred during installation:”,

" Exception of type ‘System.OutOfMemoryException’ was thrown.",

“git package files install completed. Performing other installation steps.”,

“The install of git was NOT successful.”,

“git not installed. An error occurred during installation:”,

" Exception of type ‘System.OutOfMemoryException’ was thrown.",

“”,

“Chocolatey installed 0/2 packages. 2 packages failed.”,

" See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).",

“”,

“Failures”,

" - git.install (exited 5) - Error while running ‘C:\ProgramData\chocolatey\lib\git.install\tools\chocolateyInstall.ps1’.",

" See log for details.",

" - git (exited 1) - git not installed. An error occurred during installation:",

" Exception of type ‘System.OutOfMemoryException’ was thrown."

]

Then when I look at the log, I can see this on the machine:
12 15:23:06,611 3344 [DEBUG] - Received arguments: install git --fail-on-unfound --yes --no-progress --limit-output --timeout 2700

If I run this manually in Powershell:
choco install git --fail-on-unfound --yes --no-progress --limit-output --timeout 2700

It works fine and super good.

I can only assume that it is the module. Anybody can help me with this?

-Simon

This could be a result of a few things, what I would try is;

  • Use win_command to run ‘choco install git --yes --no-progress’
  • If this fails then the error probably lies within the WinRM memory limits placed on a process
  • If it doesn’t fail then something might be up with the module
  • Check if you can install any other chocolatey packages can be installed
  • If not, then something is up with your Chocolatey install- Try running with async, this should escape the WinRM memory limits I mentioned above
  • Have a look on the server when running your win_chocolatey task and see what is taking up all the memory (powershell.exe, choco.exe, or some other exe)
    Thanks

Jordan

You are right Jordan, I could use win_command instead.

As of now, Git is the only software I need, and wanted it in an automated way, chocolatey was the easiest until that happens…

I will look into all that stuff, thank you, that should give me enough to look at.

Thank you!

-Simon

Hi Jordan,

Just for your information,

I guess I did not read the documentation properly, the winrm memory fix helped to run the everything through.

Although, it does not seem to work as expected. In the log I can see " Software installed to ‘C:\Program Files\Git\’"

This is when I run ansible-playbook with verbose.

When I go and look on the server, the files are not present. which gets me wondering.

Also if I run the uninstall manually, it looks like git was not installed.

Anyway, I will probably just run win_command instead. But I figured I should state the issue here.

-Simon