ansible.windows.win_share module – Manage Windows shares
Note
This module is part of the ansible.windows collection (version 2.8.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install ansible.windows.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: ansible.windows.win_share.
Synopsis
- Add, modify or remove Windows share and set share permissions. 
Requirements
The below requirements are needed on the host that executes this module.
- As this module used newer cmdlets like New-SmbShare this can only run on Windows 8 / Windows 2012 or newer. 
- This is due to the reliance on the WMI provider MSFT_SmbShare https://msdn.microsoft.com/en-us/library/hh830471 which was only added with these Windows releases. 
Parameters
| Parameter | Comments | 
|---|---|
| Set the CachingMode for this share. Choices: 
 | |
| Specify user list that should get read and write access on share, separated by comma. | |
| Specify user list that should get no access, regardless of implied access on share, separated by comma. | |
| Share description. | |
| Sets whether to encrypt the traffic to the share or not. Choices: 
 | |
| Specify user list that should get full access on share, separated by comma. | |
| Specify whether to allow or deny file listing, in case user has no permission on share. Also known as Access-Based Enumeration. Choices: 
 | |
| Share name. | |
| Share directory. | |
| Specify user list that should get read access on share, separated by comma. | |
| Whether to add or set (replace) access control entries. Choices: 
 | |
| Specifies the scope name of the share. For use with Windows Server failover cluster file server resources. When defined, path must be located on a cluster shared volume/disk. | |
| Specify whether to add  Choices: 
 | 
Examples
- name: Add secret share
  ansible.windows.win_share:
    name: internal
    description: top secret share
    path: C:\shares\internal
    list: false
    full: Administrators,CEO
    read: HR-Global
    deny: HR-External
- name: Add public company share
  ansible.windows.win_share:
    name: company
    description: top secret share
    path: C:\shares\company
    list: true
    full: Administrators,CEO
    read: Global
- name: Add failover cluster role share
  ansible.windows.win_share:
    name: backups
    scope_name: FCMSSQL01
    description: SQL Backups
    path: E:\sqlbackup
    list: true
    full: svc.mssql
    read: Global
- name: Remove previously added share
  ansible.windows.win_share:
    name: internal
    state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Description | 
|---|---|
| A list of action cmdlets that were run by the module. Returned: success Sample:  | 
Authors
- Hans-Joachim Kliemeck (@h0nIg) 
- David Baumann (@daBONDi) 
- Shachaf Goldstein (@Shachaf92) 
- Joe Zollo (@zollo) 
