I mapped a network drive using win_mapped_drive.
But it is not available for next tasks in the play.
My Playbook:
-------------------
---
- hosts: winvm
gather_facts: no
strategy: free
tasks:
- name: Copy Inventory
win_copy:
src: inventory.yml
dest: c:\Build\
- name: Mount Share
win_mapped_drive:
letter: M
path: '\\companyautobuild\company r9.9 Cougar Builds'
username: companyuser
password: interOP@123
- name: copy file
raw: 'Copy-Item "M:\VS_2017\X64 Bit Builds\company X64
Builds\23-08-2019\exe1.exe" C:\Build"'
Getting error:
---------------------
TASK [copy file]
***************************************************************
fatal: [192.168.63.204]: FAILED! => {"changed": true, "msg": "non-zero
return code", "rc": 1, "stderr": "Copy-Item : Cannot find drive. A drive
with the name 'M' does not exist.\r\nAt line:1 char:1\r\n+ Copy-Item
\"M:\\VS_2017\\X64 Bit Builds\\company X64 Builds\\23-08-2019\\erwi
...\r\n+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n
+ CategoryInfo : ObjectNotFound: (M:String) [Copy-Item],
DriveNotFoundException\r\n + FullyQualifiedErrorId :
DriveNotFound,Microsoft.PowerShell.Commands.CopyItemCommand\r\n ",
"stderr_lines": ["Copy-Item : Cannot find drive. A drive with the name 'M'
does not exist.", "At line:1 char:1", "+ Copy-Item \"M:\\VS_2017\\X64 Bit
Builds\\company X64 Builds\\23-08-2019\\erwi ...", "+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
" + CategoryInfo : ObjectNotFound: (M:String) [Copy-Item],
DriveNotFoundException", " + FullyQualifiedErrorId :
DriveNotFound,Microsoft.PowerShell.Commands.CopyItemCommand", " "],
"stdout": "", "stdout_lines": []}
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c3adea3a-ec37-4d77-ba9b-3240a942b09d%40googlegroups.com.