arensb.truenas.sharing_webdav module – Manage WebDAV shares

Note

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

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 arensb.truenas.

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

New in arensb.truenas 1.15.0

Synopsis

  • Create, manage, and delete WebDAV shares.

  • This only works on TrueNAS CORE. For SCALE, there is a separate WebDAV application.

Parameters

Parameter

Comments

chown

string

If true, change the ownership of all files to user webdav, group webdav.

If false, files to be shared must be manually updated to be owned by group webdav or www.

Default: true

description

string

Human-readable description of the share.

enabled

boolean

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

This has no effect if state is absent.

Choices:

  • false

  • true ← (default)

name

string / required

Name of the share. This is an identifier.

path

string / required

Directory (path) to be shared.

ro

boolean

If true, this share is read-only, i.e., users may not write to it.

Choices:

  • false ← (default)

  • true

state

string

Whether the share should exist or not.

Choices:

  • "present" ← (default)

  • "absent"

Examples

# Turn on WebDAV, configure it, and create a share.
- name: Configure WebDAV
  hosts: myhosts
  become: yes
  tasks:
    - name: Create SMS backup directory
      arensb.truenas.sharing_webdav:
        name: myshare
        path: "/mnt/tank/myfilesystem/myshare"
    - name: Configure WebDAV service
      arensb.truenas.webdav:
        protocol: HTTP
        port: 9100
        password: "{{ webdav_password }}"
        auth_type: BASIC
    - name: Enable WebDAV service
      arensb.truenas.service:
        name: webdav
        state: started
        enabled: yes

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 created or modified share.

Returned: success

Sample: {"comment": "WebDAV share for test data", "enabled": true, "id": 16, "locked": false, "name": "test1", "path": "/mnt/tank/data/test1", "perm": true, "ro": false}