I’m using OpenSSH to connect to Windows boxes to avoid having to deal with WinRM. So far it is working pretty good, but I have found an issue and i’m hoping someone has an idea.
The first task runs fine, and installs chocolatey, since it is not on the box. The second fails with “Failed to find Chocolatey installation, make sure choco.exe is in the PATH env value”.
The PATH is not picking up that chocolatey has been added. If I add a win_reboot between the two, then it works fine. That seems like a bit excessive. Is there a way to get the PATH to update, or have ansible break the connection and reconnect?
Running refreshenv in powershell via win_shell:
The term ‘Refreshenv’ is not recognized as the name of a cmdlet, function, script file or operable program.
Running
$env:Path = [System.Environment]::GetEnvironmentVariable(“Path”,“Machine”) + “;” + [System.Environment]::GetEnvironmentVariable(“Path”,“User”)
executes successfully, but doesn’t seem to fix the problem. The following commands still fail with “Failed to find Chocolatey installation”