@ -33,6 +33,7 @@ $skipscripts = Get-AnsibleParam -obj $params -name "skip_scripts" -type "bool" -
$proxy_url = Get-AnsibleParam -obj $params -name " proxy_url " -type " str "
$proxy_username = Get-AnsibleParam -obj $params -name " proxy_username " -type " str "
$proxy_password = Get-AnsibleParam -obj $params -name " proxy_password " -type " str " -failifempty ( $proxy_username -ne $null )
$architecture = Get-AnsibleParam -obj $params -name " architecture " -type " str " -default " default " -validateset " default " , " x86 "
$result = @ {
changed = $false
@ -192,7 +193,8 @@ Function Choco-Upgrade
[ bool ] $allowprerelease ,
[ string ] $proxy_url ,
[ string ] $proxy_username ,
[ string ] $proxy_password
[ string ] $proxy_password ,
[ string ] $architecture
)
if ( -not ( Choco-IsInstalled $package ) )
@ -202,6 +204,10 @@ Function Choco-Upgrade
$options = @ ( " -y " , $package , " --timeout " , " $timeout " , " --failonunfound " )
switch ( $architecture ) {
" x86 " { $options + = " --x86 " ; break }
}
if ( $check_mode )
{
$options + = " --whatif "
@ -306,6 +312,7 @@ Function Choco-Upgrade
$result . failed = $false
}
Function Choco-Install
{
[ CmdletBinding ( ) ]
@ -327,7 +334,8 @@ Function Choco-Install
[ bool ] $allowprerelease ,
[ string ] $proxy_url ,
[ string ] $proxy_username ,
[ string ] $proxy_password
[ string ] $proxy_password ,
[ string ] $architecture
)
if ( Choco-IsInstalled $package )
@ -340,7 +348,7 @@ Function Choco-Install
-ignorechecksums $ignorechecksums -ignoredependencies $ignoredependencies `
-allowdowngrade $allowdowngrade -proxy_url $proxy_url `
-proxy_username $proxy_username -proxy_password $proxy_password `
-allowprerelease $allowprerelease
-allowprerelease $allowprerelease -architecture $architecture
return
}
elseif ( -not $force )
@ -351,6 +359,10 @@ Function Choco-Install
$options = @ ( " -y " , $package , " --timeout " , " $timeout " , " --failonunfound " )
switch ( $architecture ) {
" x86 " { $options + = " --x86 " ; break }
}
if ( $check_mode )
{
$options + = " --whatif "
@ -529,7 +541,7 @@ if ($state -in ("downgrade", "latest", "present", "reinstalled")) {
-ignorechecksums $ignorechecksums -ignoredependencies $ignoredependencies `
-allowdowngrade ( $state -eq " downgrade " ) -proxy_url $proxy_url `
-proxy_username $proxy_username -proxy_password $proxy_password `
-allowprerelease $allowprerelease
-allowprerelease $allowprerelease -architecture $architecture
}
Exit-Json -obj $result