Ansible not installing msi through shared drive

Team,

My ansible version is 2.9.1. Here I’m trying to install a msi, placed in a shared drive, on windows 10 VDI.

These are 2 play books I’ve tried

A few things

  • Each task is run in a completely separate shell from each other, running net use in a previous task won’t have any affect on any subsequent tasks

  • Don’t try to use mapped drives with Ansible, or really any other non-interactive purpose

    • Mapped drives are really only useful for interactive logons, they don’t play well for anything else
      If you are trying to access an msi from a network path the method we recommend is to use become like so
  • name: Install MSI
    win_package:
    path: \xxxx\tttt\ppp\Application.msi
    state: present
    become: yes
    become_method: runas
    become_flags: logon_type=new_credentials logon_flags=netcredentials_only
    vars:
    ansible_become_user: domain\user
    ansible_become_pass: pass

We cover more about become and WIndows at https://docs.ansible.com/ansible/latest/user_guide/become.html#become-and-windows but what that task basically does is to run your installer using the connection user but any outbound network attempts will use those credentials, just like net use would do.