New in version 2.4.
parameter | required | default | choices | comments |
---|---|---|---|---|
letter | yes | The letter of the network path to map to. This letter must not already be in use with Windows. | ||
password | no | The password for username . | ||
path | no | The UNC path to map the drive to. This is required if state=present .If state=absent and path is not set, the module will delete the mapped drive regardless of the target.If state=absent and the path is set, the module will throw an error if path does not match the target of the mapped drive. | ||
state | no | present |
| If state=present will ensure the mapped drive exists.If state=absent will ensure the mapped drive does not exist. |
username | no | Credentials to map the drive with. The username MUST include the domain or servername like SERVER\user, see the example for more information. |
- name: create a mapped drive under Z win_mapped_drive: letter: Z path: \\domain\appdata\accounting - name: delete any mapped drives under Z win_mapped_drive: letter: Z state: absent - name: only delete the mapped drive Z if the paths match (error is thrown otherwise) win_mapped_drive: letter: Z path: \\domain\appdata\accounting state: absent - name: create mapped drive with local credentials win_mapped_drive: letter: M path: \\SERVER\c$ username: SERVER\Administrator password: Password - name: create mapped drive with domain credentials win_mapped_drive: letter: M path: \\domain\appdata\it username: DOMAIN\IT password: Password
Note
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/win_mapped_drive_module.html