Team,
My ansible version is 2.9.1. Here I'm trying to install a msi, placed in a shared drive, on windows 10 VDI.
These are 2 play books I've tried
-----------------------------------------------------------------------
- name: Install Monitoring Service for VDI
hosts: all
tasks:
- name: Maping Network Drive
win_command: net use "Z:" "\\xxxx\tttt\ppp" /user:domain\user "pass"
- name: Directory
win_command: net use
- name: Install MSI
win_package:
path:
\\xxxx\tttt\ppp\Application.msi
state: present
- name: Unmap drive
win_command: net use "Z:" /delete
In this case I get this error at msi installation stage
The full traceback is:
Access is denied
At line:196 char:27
+ ... $valid_path = Test-Path -LiteralPath $test_path -PathType Leaf
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (\\xxxx\tt...pp\Application.msi:String) [Test-Path], UnauthorizedAccessException
+ FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.TestPathCommand
ScriptStackTrace:
at Get-ProgramMetadata, <No file>: line 196
at <ScriptBlock>, <No file>: line 301
System.UnauthorizedAccessException: Access is denied ---> System.ComponentModel.Win32Exception: Access is denied
--- End of inner exception stack trace ---
at Microsoft.PowerShell.Commands.FileSystemProvider.ItemExists(String path, ErrorRecord& error)
fatal: [IP address]: FAILED! => {
"changed": false,
"msg": "Unhandled exception while executing module: Access is denied"
----------------------------------------------------------------------- ---------------------------------------------------------------------
In 2nd Playbook I have changed the msi path to local drive like this
- name: Install MSI
win_package:
path: Z:\\Application.msi
state: present
And the error I get
fatal: [IP address]: FAILED! => {
"changed": false,
"msg": "the file at the local path Z:\\\\Application.msi cannot be reached",
"reboot_required": false
}
----------------------------------------------------------------------- -----------------------------------------------------------------------
In both the cases, after running the playbook, the output of the 2nd command
name: Directory
win_command: net use
"New connections will be remembered.",
"",
"",
"Status Local Remote Network",
"",
"-------------------------------------------------------------------------------",
"Unavailable Z:
\\xxxx\tttt\ppp ",
" Microsoft Windows Network",
"The command completed successfully.",
----------------------------------------------------------------------- -----------------------------
The authentication I'm using is ntlm and in my organization only ntlm and kerberos is allowed.
Any suggestions here. Can anyone suggest a way to install this msi. I've tried to install msi using manual steps in which:
1. Created Enter-PsSession with windows 10 workstation remotely
2. mapped the shared drive using net use command
3. Installed using msiexec command
This is working. Then why it is not working with ansible because Enter-PsSession also use winrm. Please help!!
Thank you