-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
win_psmodule fails due to PackageManagement requiring NuGet #147
Comments
Workaround : add the following task before using win_psmodule |
Works for me! 👍 But does this re-install everytime? |
this is still broken on Ansible 6.6.0 with Ansible-core-2.13.6. Ansible V7 also had the same issue. |
Does anyone has a solution to make |
If is set parameter My module installation code:
|
I very recently used maximum_version instead of required_version for the exact same module (sqlserver) and it was fine. |
With ANSIBLE VERSION
OS / ENVIRONMENT ERROR LOG
|
If it helps. With the PackageProvider Idempodency Case i do the following - name: Make Nuget Package Provider exist
ansible.windows.win_powershell:
script: "{{ lookup('file', 'files/Install-PackageProvider-NuGet.ps1') }}"
register: powershell_result
- name: Debug powershell_result
ansible.builtin.debug:
var: powershell_result
if($null -eq $Ansible){
$Ansible = @{}
}
$pProv=Get-PackageProvider | Where-Object{$_.Name -eq "NuGet"}
if($null -ne $pProv){
$Ansible.Changed = $false
# OK
return
}
else{
$pProv=$null
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
$Ansible.Changed = $true
$pProv=Get-PackageProvider | Where-Object{$_.Name -eq "NuGet"}
if($null -ne $pProv){
# OK
}
else{
$Ansible.Failed=$true
}
} |
@RudolfAchter worked like a charm! thanks. |
Is anyone working on a fix for this? Asking so I don't duplicate work. This seems like an easy fix. Can't guarantee I'll have time but if I do I might give it a shot. |
Issue is still valid. |
Started happening today when I needed to use the |
SUMMARY
win_psmodule
fails due toPackageManagement
requiring NuGet.ISSUE TYPE
COMPONENT NAME
win_psmodule
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Windows Server 2012 R2 Datacenter
PowerShell 5.1.14409.1018
STEPS TO REPRODUCE
Apply playbook
EXPECTED RESULTS
Module is installed
ACTUAL RESULTS
win_psmodule.ps1
has anInstall-NugetProvider
function to make sure NuGet provider is available, however it is called only afterImport-Module -Name PackageManagement, PowerShellGet
at line 427.The text was updated successfully, but these errors were encountered: