I'm trying to use Ansible to install software on Windows server 2008 R2 via win_chocolatey module. It doesn't work as it throws error:
[ERROR] – Chocolatey had an error on WIN-2008r2 (with user Administrator): System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at System.Runtime.CompilerServices.RuntimeHelpers._CompileMethod(IRuntimeMethodInfo method) at System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType, Object target) at System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator) at System.Management.Automation.Interpreter.LoopCompiler.CreateDelegate() at System.Management.Automation.Interpreter.EnterLoopInstruction.Compile(Object frameObj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch()
Command "choco install" works when used on the server.
I tried to increase memory limit for PowerShell and for WinRM.
set-item wsman:localhost\Shell\MaxMemoryPerShellMB 2048
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="2048"}'
What else could be the problem?
Best Answer
It turns out I needed this fix: https://support.microsoft.com/en-us/help/2842230/-out-of-memory-error-on-a-computer-that-has-a-customized-maxmemorypershellmb-quota-set-and-has-wmf-3.0-installed
Now it works.