1) to use Ansible to map this network drive automatically in all VMs for the domain user (mapped drive should be visible after VM reboots, during every RDP sessions using this credentials?
- win_mapped_drive:
name: Z
path: \\bellagio.infra.vegas.net\how\the\hell\to\solve\this\issue
state: present
become: yes
become_method: runas
vars:
ansible_become_user: '{{ ansible_user }}'
ansible_become_pass: '{{ ansible_password }}'
- win_credential:
name: bellagio.infra.vegas.net
type: domain_password
username: custom user
secret: password
state: present
become: yes
become_method: runas
vars:
ansible_become_user: '{{ ansible_user }}'
ansible_become_pass: '{{ ansible_password }}'
2) to use this mapped drive as a 'repo place' for future purposes - to copy scrips, apps from this drive to VMs using Ansible?
- name: Mount Z drive
win_mapped_drive:
letter: Z
path: \\bellagio.infra.vegas.net\how\the\hell\to\solve\this\issue
state: present
become: yes
become_method: runas
vars:
ansible_become_user: '{{ ansible_user }}'
ansible_become_pass: '{{ ansible_password }}'
TASK [Mount Z drive] ****************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:13
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_mapped_drive.ps1
Pipelining is enabled.
<99.88.77.60> ESTABLISH WINRM CONNECTION FOR USER: elvis@INTRA.VEGAS.NET on PORT 5986 TO 99.88.77.66
EXEC (via pipeline wrapper)
changed: [99.88.77.66] => {
"changed": true,
"invocation": {
"module_args": {
"letter": "Z",
"password": null,
"path": "\\\\bellagio.infra.vegas.net\how\the\hell\to\solve\this\issue",
"state": "present",
"username": null
}
}
}
META: ran handlers
META: ran handlers
PLAY RECAP **************************************************************************************************************************************************************************************************
10.42.197.227 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
PS C:\Users\elvis> gdr -PSProvider 'FileSystem'
Name Used (GB) Free (GB) Provider Root CurrentLocation
---- --------- --------- -------- ---- ---------------
A FileSystem A:\
C 17.67 81.80 FileSystem C:\ Users\elvis
D FileSystem D:\
E 0.14 99.86 FileSystem E:\
bellagio).
Computer\HKEY_CURRENT_USER\Network\Z
(Default): REG_SZ (value not set)
ConnectFlags: REG_DWORD 0x00000000
ConnectionType: REG_DWORD 0x00000001
DeferFlags: REG_DWORD 0x00000004
ProviderName: REG_SZ Microsoft Windows Network
ProviderType: REG_DWORD 0x00020000
RemotePath: REG_SZ \\bellagio.intra.vegas.net\how\the\hell\to\solve\this\issue
UserName REG_SZ
Computer\HKEY_CURRENT_USER\Network\Z
(Default): REG_SZ (value not set)
ConnectFlags: REG_DWORD 0x00000000
ConnectionType: REG_DWORD 0x00000001
DeferFlags: REG_DWORD 0x00000004
ProviderName: REG_SZ Microsoft Windows Network
ProviderType: REG_DWORD 0x00020000
RemotePath: REG_SZ \\bellagio.intra.vegas.net\how\the\hell\to\solve\this\issue
UserName REG_SZ
PS C:\Users\elvis> gdr -PSProvider 'FileSystem'
Name Used (GB) Free (GB) Provider Root CurrentLocation
---- --------- --------- -------- ---- ---------------
A FileSystem A:\
C 17.67 81.79 FileSystem C:\ Users\elvis
D FileSystem D:\
E 0.14 99.86 FileSystem E:\
PS C:\Users\elvis> net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
Unavailable Z: \\bellagio.intra.vegas.net\how\the\hell\to\solve\this\issue
Microsoft Windows Network
\\TSCLIENT\C Microsoft Terminal Services
\\TSCLIENT\S Microsoft Terminal Services
\\TSCLIENT\V Microsoft Terminal Services
\\TSCLIENT\W Microsoft Terminal Services
\\TSCLIENT\X Microsoft Terminal Services
\\TSCLIENT\Y Microsoft Terminal Services
\\TSCLIENT\Z Microsoft Terminal Services
The command completed successfully.
PS C:\Windows\system32> gdr -PSProvider 'FileSystem'
Name Used (GB) Free (GB) Provider Root CurrentLocation
---- --------- --------- -------- ---- ---------------
A FileSystem A:\
C 17.67 81.79 FileSystem C:\ Windows\system32
D FileSystem D:\
E 0.14 99.86 FileSystem E:\
Z 465267.94 178455.74 FileSystem \bellagio.intra.vegas.net\how...
PS C:\Windows\system32> net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
OK Z: \\bellagio.intra.vegas.net\how\the\hell\to\solve\this\issue
Microsoft Windows Network
\\TSCLIENT\C Microsoft Terminal Services
\\TSCLIENT\S Microsoft Terminal Services
\\TSCLIENT\V Microsoft Terminal Services
\\TSCLIENT\W Microsoft Terminal Services
\\TSCLIENT\X Microsoft Terminal Services
\\TSCLIENT\Y Microsoft Terminal Services
\\TSCLIENT\Z Microsoft Terminal Services
The command completed successfully.
PS C:\Users\elvis> cmdkey.exe /list
Currently stored credentials:
Target: MicrosoftAccount:target=SSO_POP_Device
Type: Generic
User: 02yahgcuuqfcntfq
Saved for this logon only
Target: WindowsLive:target=virtualapp/didlogical
Type: Generic
User: 02yahgcuuqfcntfq
Local machine persistence
PS C:\Windows\system32> cmdkey.exe /list
Currently stored credentials:
Target: MicrosoftAccount:target=SSO_POP_Device
Type: Generic
User: 02yahgcuuqfcntfq
Saved for this logon only
Target: WindowsLive:target=virtualapp/didlogical
Type: Generic
User: 02yahgcuuqfcntfq
Local machine persistence
PS C:\Users\elvis> cmdkey.exe /list
Currently stored credentials:
Target: MicrosoftAccount:target=SSO_POP_Device
Type: Generic
User: 02yahgcuuqfcntfq
Saved for this logon only
Target: WindowsLive:target=virtualapp/didlogical
Type: Generic
User: 02yahgcuuqfcntfq
Local machine persistence