Support lists of packages in win_winget module
This commit is contained in:
parent
a9aa1bdaaf
commit
1995bf3bc2
@ -6,8 +6,9 @@
|
||||
$module = [Ansible.Basic.AnsibleModule]::Create($args, @{
|
||||
options = @{
|
||||
name = @{
|
||||
type = "str"
|
||||
default = $null
|
||||
type = "list"
|
||||
elements = "str"
|
||||
required = $true
|
||||
}
|
||||
state = @{
|
||||
type = "str"
|
||||
@ -18,7 +19,7 @@ $module = [Ansible.Basic.AnsibleModule]::Create($args, @{
|
||||
supports_check_mode = $false
|
||||
})
|
||||
|
||||
$name = $module.Params.name
|
||||
$names = $module.Params.name
|
||||
$state = $module.Params.state
|
||||
$winget = Get-ExecutablePath "winget"
|
||||
$noPackageString = "No installed package found matching input criteria."
|
||||
@ -48,6 +49,7 @@ function Test-UpgradeAvailable {
|
||||
return $true
|
||||
}
|
||||
|
||||
foreach ($name in $names) {
|
||||
switch ($state) {
|
||||
"absent" {
|
||||
if (Test-Installed) {
|
||||
@ -91,6 +93,7 @@ switch ($state) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$module.Result.rc = 0
|
||||
$module.ExitJson()
|
||||
|
@ -11,7 +11,7 @@ options:
|
||||
name:
|
||||
description:
|
||||
- Name of the package to manage.
|
||||
type: str
|
||||
type: list[str]
|
||||
state:
|
||||
description:
|
||||
- Indicates the desired package state. V(latest) ensures that the latest
|
||||
|
Loading…
x
Reference in New Issue
Block a user