Thanks Jordan,
I used become in my playbook.
- hosts: [win]
gather_facts: false
tasks:
- name: create a mapped drive
win_mapped_drive:
state: present
letter: D
path: \\10.237.163.116\test
vars:
# become is required to save and retrieve the credentials in the tasks
ansible_become: yes
ansible_become_method: runas
ansible_become_user: test
ansible_become_pass: password@123
ansible_become_flags: logon_type=new_credentials
logon_flags=netcredentials_only
Playbook is running without any errors.
But i am not seeing the network drive in my windows OS.
net use:
Unavailable T: \\10.237.163.116\test Microsoft Windows Network
what is that i am missing here. what is the solution to map the network
drive.
On Friday, 15 May 2020 02:36:13 UTC+5:30, Jordan Borean wrote:
>
> The error you have is nothing to do with mapped drives but that Ansible is
> unable to authenticate itself over the WinRM connection. YOu need to set
> ansible_user and ansible_password for Ansible to use as the connection
> credentials.
>
> Also please note that while you can map a network drive using
> win_mapped_drive in Ansible, you cannot use that mapped drive in Ansible
> tasks. That mapping is just for interactive logons. If you want to access
> files from a network path in Ansible you need to use the UNC path and
> potentially use become to add outbound creds to your process. We have an
> example of that here
> https://docs.ansible.com/ansible/latest/user_guide/become.html#become-flags-for-windows
> .
>
--
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/18f5b50d-415a-4fc4-8e0b-0c7d383f0dae%40googlegroups.com.