-
Notifications
You must be signed in to change notification settings - Fork 163
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 needs to address -AcceptLicense parameter #340
Comments
Some additional relevant info: |
This has caused a breaking change as not all PS modules accept the -acceptlicense parameter such as the FailoverClusterDSC module. |
I still get a parameter error on when trying to execute the module. I see in your example its listed as acceptlicense and not accept_license , was that a typo? |
I was getting the same error, I had to add - name: Install Nuget (for Pscx)
win_psmodule:
name: NuGet
accept_license: true
skip_publisher_check: true
state: present |
Agree this is a breaking change 😟. This parameter should be optional as not all modules support. |
I'm still having the issue of modules randomly reporting "cannot be found that matches parameter name 'AcceptLicense'." |
same here. The installation of the PowerShellGet with the fatal: [ansibleHost]: FAILED! => { Ansible version ansible-playbook [core 2.14.2] |
Can this issue be reopened. It's no longer working correctly with the license parameters. @jborean93 |
Same for me, it is not working anymore |
Has been fixed with #488 and will be present in the next release. |
I just ran into this problem. The To work around this issue, I ran a win_shell beforehand to specifically ensure this module is updated so that
|
Even Windows Server 2022 still ships with PowerShellGet version 1.0.0.1 and is affected by this issue. Looks like the best course of action is pre-installing a newer version of PowerShellGet in our VM templates... |
So I installed the latest version of the community.windows collection (2.0), but I believe my Ansible isn't using it because an "ansible-galaxy collection list" is showing 3 different community.windows installed in 3 different locations. How to I make Ansible exclusively use 2.0? |
I run this before installing required PS Modules: - name: Install NuGet if necessary
ansible.windows.win_shell: |
$providers = (Get-PackageProvider | Where-Object -Property Name -Match nuget)
if ($providers -eq $null) {
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope AllUsers
}
changed_when: False
# See https://github.com/ansible-collections/community.windows/issues/340
- name: Install upgraded PowershellGet if necessary
ansible.windows.win_shell: |
$module = Get-Module -ListAvailable -Name 'PowerShellGet' | Sort-Object -Property Version -Descending | Select-Object -First 1
if ($module -eq $null -or $module.Version -le [Version]'1.0.0.1') {
Install-Module -Name 'PowerShellGet' -Repository 'PSGallery' -Scope 'AllUsers' -AllowClobber -Force -Confirm:$false
}
changed_when: False
# EXAMPLE
- name: Install or update an existing PSWindowsUpdate module to the newest version
community.windows.win_psmodule:
name: PSWindowsUpdate
state: latest
accept_license: True Also check your To my mind, this issue is still a bug. I understand that On PowerShell 5.x required modules and a package provider will be updated under the first run of the win_psmodule module. is not honored, or something happened after. |
SUMMARY
Support the AcceptLicense parameter for the Install-Module powershell cmdlet used by win_psmodule's Install-PsModule function.
ISSUE TYPE
COMPONENT NAME
win_psmodule -> Function Install-PsModule
ADDITIONAL INFORMATION
There are some PowerShell modules that require the -AcceptLicense parameter to be passed to Install/Update-Module. For example, the HPCMSL module has a dependent module HP.Private that will not install without passing this parameter and returns an error.
This could be handled by adding an optional parameter to the win_psmodule, or by automatically applying it in the Install-PsModule function. I think best practice should be to add it as a boolean option to win_psmodule and default to false. This would be consistent retroactively with existing playbooks, and would help document when the parameter is required.
The text was updated successfully, but these errors were encountered: