Ansible: mapping network drive issues

86 Views Asked by At

After performing Ansible playbook with task responsible for mapping network drive (I didn't use the win_mapped_drive module, used powershell commands) with a result Successful , mapped drive is not visible after RDP to the PC client where it was performed.

  1. Ansible playbook task below. Vars are defined in a client specific .yml file and were substituted correctly.
-
  name: Step 9 Map a network drive with new credentials - tag share_mod
  win_shell: $driveLetter = "T" ; $networkPath = "{{ fs_path }}" ; $username = "{{ fs_acc }}" ; $securePassword = ConvertTo-SecureString -String "{{ fs_acc_pwd }}" -AsPlainText -Force ; $credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $securePassword ; New-PSDrive -Name $driveLetter -PSProvider "FileSystem" -Root $networkPath -Credential $credential  -Persist
  tags:
    - share_add
  1. After RDP to this PC Client, there is no mapped drive with a letter T Vie from File Explrer

  2. Output from Powershell non-admin powershell non-admin

  3. Output from Powershell as admin powershell admin There the Local Path Z: is displayed because of the drive mapped manually on the same PC Client but on a different user profile.

0

There are 0 best solutions below