arensb.truenas.sharing_nfs module – Manage NFS 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_nfs.

New in arensb.truenas 0.1.0

Synopsis

  • Create, manage, and delete NFS exports.

Parameters

Parameter

Comments

alldirs

boolean

Allows clients to mount any subdirectory of the exported directory.

Can only be used on exports that contain only one directory.

False by default when a share is created.

Choices:

  • false

  • true

enabled

boolean

Whether or not this export should be enabled.

Exports that are not enabled exist in the middleware database, but are not listed in /etc/exports.

True by default when a share is created.

Choices:

  • false

  • true

hosts

list / elements=string

List of allowed hosts, either hostnames or addresses.

An empty list means to allow all.

mapall_group

string

All requests (including by root) are limited to the permissions of this group.

Set to the empty string ("") to remove this setting.

Mutually-exclusive with maproot_group.

Requires mapall_user.

mapall_user

string

All requests (including by root) are limited to the permissions of this user.

Set to the empty string ("") to remove this setting.

Mutually-exclusive with maproot_user.

maproot_group

string

Requests by user root are also limited to the permissions of this group.

Set to the empty string ("") to remove this setting.

Mutually-exclusive with mapall_group.

Requires maproot_user.

maproot_user

string

Requests by user root are limited to the permissions of this user.

Set to the empty string ("") to remove this setting.

Mutually-exclusive with mapall_user.

name

aliases: comment

string / required

Name for this export group.

This will show up as the comment.

Default: ""

networks

list / elements=string

List of allowed networks, in CIDR notation.

An empty list means to allow all.

Note that using incorrect CIDR may lead to this module seeing a change when nothing has changed. For example, if you specify “10.1.2.3/16”, TrueNAS will normalize this to “10.1.0.0/16”, but afterward, this module will think that you want to make a change.

path

string / required

A directory to export.

paths

list / elements=string / required

Deprecated; use path instead.

List of directories to export.

All paths must be in the same filesystem. And if multiple directories from the same filesystem are being imported, they must be in the same NFS export.

quiet

boolean

Suppress certain error messages. This can be used to avoid spamming log files with messages about known errors. See exports(5) for examples.

False by default when a share is created.

Choices:

  • false

  • true

readonly

aliases: ro, read_only

boolean

Whether the directories are exported read-only, to prohibit clients from writing to them.

Choices:

  • false

  • true

state

string

Whether this export should exist or not.

Choices:

  • "absent"

  • "present" ← (default)

Examples

- name: Export a filesystem
  arensb.truenas.sharing_nfs:
    - name: Home export
      path: /mnt/pool0/home

- name: Export to only one network
  arensb.truenas.sharing_nfs:
    - name: Home export
      path: /mnt/pool0/home
      networks:
        - 192.168.0.0/16

- name: Explicitly export to all hosts and networks
  arensb.truenas.sharing_nfs:
    - name: Home export
      path: /mnt/pool0/home
      hosts: []
      networks: []