win_mapped_drive, drive not found

5 views
Skip to first unread message

uday kiran

unread,
Aug 23, 2019, 8:09:38 AM8/23/19
to Ansible Project
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": []}




Reply all
Reply to author
Forward
0 new messages