community.windows
community.windows copied to clipboard
"User prompt failed" during win_psmodule execution
SUMMARY
When I try to install a powershell module with win_psmodule
module, I get following error:
fatal: [vagrant-win2012r2]: FAILED! =>
{
"changed":false,
"msg":"Problems adding a prerequisite module PowerShellGet Exception calling \"ShouldContinue\" with \"2\" argument(s): \"A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\\Program Files\\PackageManagement\\ProviderAssemblies' or 'C:\\Users\\vagrant\\AppData\\Local\\PackageManagement\\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now?\"",
"nuget_changed":false,
"output":"",
"repository_changed":false
}
ISSUE TYPE
- Bug Report
COMPONENT NAME
win_psmodule.py
ANSIBLE VERSION
ansible --version
ansible 2.9.13
config file = None
configured module search path = ['/home/jpmat/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/jpmat/.local/share/virtualenvs/sap_bip-qRJ-gQZ-/lib/python3.8/site-packages/ansible
executable location = /home/jpmat/.local/share/virtualenvs/sap_bip-qRJ-gQZ-/bin/ansible
python version = 3.8.5 (default, Sep 9 2020, 10:23:44) [GCC 9.3.0]
CONFIGURATION
$ ansible-config dump --only-changed
# result is empty
OS / ENVIRONMENT
Here is ansible target info:
PS C:\Users\vagrant> (Get-WmiObject -class Win32_OperatingSystem).Caption
Microsoft Windows Server 2012 R2 Standard Evaluation
PS C:\Users\vagrant> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14409.1005
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1005
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
STEPS TO REPRODUCE
- name: Ensure PSCX powershell module is installed
win_psmodule:
name: Pscx
allow_clobber: true
EXPECTED RESULTS
Module Pscx
should be installed.
ACTUAL RESULTS
mol --debug test --destroy never
(snip)
TASK [sap_bip : Ensure PSCX powershell module is installed] ******
task path: /home/jpmat/Desktop/.../my_role/tasks/main.yml:15
Using module file /home/jpmat/.local/share/virtualenvs/sap_bip-qRJ-gQZ-/lib/python3.8/site-packages/ansible/modules/windows/win_psmodule.ps1
Pipelining is enabled.
<127.0.0.1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 55986 TO 127.0.0.1
EXEC (via pipeline wrapper)
fatal: [vagrant-win2012r2]: FAILED! => {
"changed": false,
"msg": "Problems adding a prerequisite module PowerShellGet Exception calling \"ShouldContinue\" with \"2\" argument(s): \"A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\\Program Files\\PackageManagement\\ProviderAssemblies' or 'C:\\Users\\vagrant\\AppData\\Local\\PackageManagement\\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now?\"",
"nuget_changed": false,
"output": "",
"repository_changed": false
}
dupe #147