ansible.builtin.win_share (v2.9.27) — module

Manage Windows shares

| "added in version" 2.1 of ansible.builtin"

Authors: Hans-Joachim Kliemeck (@h0nIg), David Baumann (@daBONDi)

preview | supported by core

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Add, modify or remove Windows share and set share permissions.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Playbook example
# Add share and set permissions
---
- name: Add secret share
  win_share:
    name: internal
    description: top secret share
    path: C:\shares\internal
    list: no
    full: Administrators,CEO
    read: HR-Global
    deny: HR-External
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add public company share
  win_share:
    name: company
    description: top secret share
    path: C:\shares\company
    list: yes
    full: Administrators,CEO
    read: Global
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove previously added share
  win_share:
    name: internal
    state: absent

Inputs

    
deny:
    description:
    - Specify user list that should get no access, regardless of implied access on share,
      separated by comma.
    type: str

full:
    description:
    - Specify user list that should get full access on share, separated by comma.
    type: str

list:
    default: false
    description:
    - Specify whether to allow or deny file listing, in case user has no permission on
      share. Also known as Access-Based Enumeration.
    type: bool

name:
    description:
    - Share name.
    required: true
    type: str

path:
    description:
    - Share directory.
    required: true
    type: path

read:
    description:
    - Specify user list that should get read access on share, separated by comma.
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Specify whether to add C(present) or remove C(absent) the specified share.
    type: str

change:
    description:
    - Specify user list that should get read and write access on share, separated by comma.
    type: str

encrypt:
    default: false
    description: Sets whether to encrypt the traffic to the share or not.
    type: bool
    version_added: '2.4'
    version_added_collection: ansible.builtin

description:
    description:
    - Share description.
    type: str

caching_mode:
    choices:
    - BranchCache
    - Documents
    - Manual
    - None
    - Programs
    - Unknown
    default: Manual
    description:
    - Set the CachingMode for this share.
    type: str
    version_added: '2.3'
    version_added_collection: ansible.builtin

Outputs

actions:
  description: A list of action cmdlets that were run by the module.
  returned: success
  sample:
  - New-SmbShare -Name share -Path C:\temp
  type: list