Hi Jordan,
I tried the below playbook to store the credential that Windows will use
for mapped drives. But it is throwing the below error :
- hosts: [win]
gather_facts: false
tasks:
- name: Save the network credentials required for the mapped drive
win_credential:
name: 10.224.233.199 -----> windows machine IP
type: domain_password
state: present
#persistence: local
#secret_format: text
#update_secret: always
username: Administrator-----> windows machine username
secret: opteamix------> windows machine password
become: yes
become_method: runas
vars:
# become is required to save and retrieve the credentials in the tasks
ansible_become_user: apple ----- username of the drive to be
mapped.
ansible_become_pass: barharbour -----password of the drive to be
mapped.
ansible_become_flags: logon_type=new_credentials
logon_flags=netcredentials_only
fatal: [10.234.224.199]: FAILED! => {
"changed": false,
"msg": "Unhandled exception while executing module: Exception calling
\"GetCredential\" with \"2\" argument(s): \"Failed to access the user's
credential store, run the module with become\""
Thanks,
Mahesh
On Sat, May 16, 2020 at 1:31 AM Jordan Borean <[email protected]> wrote:
> So the drive mapping is present but Windows is unable to map the drive on
> logon. You can use the win_credential [1] to store a credential that
> Windows will use for mapped drives. There's even an example of this in the
> win_mapped_drive [2] docs. If you are running the net use command through
> Ansible and expecting to see that mapped drive available then you are out
> of luck. Mapped drives are only for use with interactive logons and not for
> use in Ansible, Ansible can only manage the mappings but not use them.
>
> [1]
> https://docs.ansible.com/ansible/latest/modules/win_credential_module.html
> [2]
> https://docs.ansible.com/ansible/latest/modules/win_mapped_drive_module.html
>
> --
> 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/d013a3e5-d5d0-4aa9-b809-7850cee84167%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/d013a3e5-d5d0-4aa9-b809-7850cee84167%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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/CAGWu8HwXP%3DbA%2BPJYVxMV3KJK6cF6t_CbVt6Zt0H_DynPPTZUMQ%40mail.gmail.com.