arensb.truenas.sharing_smb module – Manage SMB sharing

Note

This module is part of the arensb.truenas collection (version 1.11.4).

To install it, use: ansible-galaxy collection install arensb.truenas.

To use it in a playbook, specify: arensb.truenas.sharing_smb.

New in arensb.truenas 1.4.3

Synopsis

  • Create, manage, and delete SMB shares.

Parameters

Parameter

Comments

abe

boolean

Enable Access Based Share Enumeration.

Choices:

  • false

  • true

acl

boolean

When set, enables ACL support for the share.

Choices:

  • false

  • true

apple_encoding

boolean

Use Apple-style character encoding.

By default, Samba uses a hashing algorithm for filename characters that are illegal in NTFS. This option causes it to translate such characters to the Unicode private range.

Choices:

  • false

  • true

auxsmbconf

string

Additional smb4.conf options.

browsable

boolean

If true, share is visible when browsing shares.

Choices:

  • false

  • true

comment

string

Description of the share, for the system maintainer.

durablehandle

boolean

Enables using file handles that can withstand short disconnections.

Enables support for POSIX byte-range locks.

Choices:

  • false

  • true

enabled

boolean

If true, the share is enabled. Otherwise, it is present but disabled.

Choices:

  • false

  • true

fsrvp

boolean

Enable File Server Remote VSS Protocol (FSRVP).

This allows RPC clients to manage snapshots for the share.

Choices:

  • false

  • true

guestok

string

Enables guest access (no login).

home

string

If true, this share may be used for home directories.

Only one such share is allowed.

hostsallow

list / elements=string

List of hostnames/IP addresses of hosts that are allowed access to the share.

If hostsallow and hostsdeny conflict, hostsallow takes precedence.

hostsdeny

list / elements=string

List of hostnames/IP addresses of hosts that are denied access to the share.

If hostsallow and hostsdeny conflict, hostsallow takes precedence.

name

string / required

Name of the share, as seen by the SMB client.

path

string / required

Directory to share, on the server.

path_suffix

string

Suffix appended to the share connection path. This may contain macros, as defined in smb.conf(5).

purpose

string

Specifies a family of configuration parameters for different use

cases. Legal values include:

NO_PRESET, DEFAULT_SHARE, ENHANCED_TIMEMACHINE, MULTI_PROTOCOL_APP, MULTI_PROTOCOL_NFS, PRIVATE_DATASETS, WORM_DROPBOX.

Note that the purpose parameter may override other parameters. In particular, DEFAULT_SHARE specifies an empty hostsallow and hostsdeny.

recyclebin

boolean

If true, enables Windows Recycle Bin: deleted files are moved to the

Recycle Bin. If false, deleted files are immediately deleted.

Choices:

  • false

  • true

ro

boolean

If true, share is read-only.

Choices:

  • false

  • true

shadowcopy

boolean

When set, export ZFS snapshots as VSS shadow copies.

Choices:

  • false

  • true

state

string

Whether the share should exist or not.

Choices:

  • "absent"

  • "present" ← (default)

streams

string

Allow multiple NTFS data streams.

timemachine

boolean

Enables support for Apple Time Machine backups.

Choices:

  • false

  • true

Examples

- name: Simple default share
  sharing_smb:
    name: export1
    path: /mnt/path1

- name: Share with host lists
  sharing_smb:
    name: export2
    path: /mnt/path2
    comment: "Shared to just a few hosts."
    purpose: NO_PRESET
    hostsallow:
      - host1.dom.ain
      - host2.dom.ain
      - 10.2.3.0/24
    hostsdeny:
      - ALL

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

share

dictionary

A data structure describing a newly-created share.

Returned: success

status

string

When this module exits abnormally, status contains an error message.

Returned: success