arensb.truenas.nfs module – Configure NFS service

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.nfs.

New in arensb.truenas 0.4.0

Synopsis

  • Configure the NFS service.

  • For individual NFS exports, see sharing_nfs

Parameters

Parameter

Comments

allow_nonroot

boolean

When true, allow non-root requests to be served.

Sets the -n option to mountd.

Choices:

  • false

  • true

bindip

list / elements=string

List of IP addresses on which to listen for NFS requests. When this is the empty list, listen on all available addresses.

domain

string

Overrides the default DNS domain name for NFSv4.

Passes the -domain option to nfsuserd.

Ignored unless nfsv4 is true.

krb

string

Turn on Kerberos for NFSv4. Forces shares to fail without a Kerberos ticket.

This enables the gssd daemon.

Ignored unless nfsv4 is true.

mountd_log

boolean

When true, log successful mount requests.

Passes the -l option to mountd.

Choices:

  • false

  • true

mountd_port

integer

Specifies the port that mountd should bind to.

This passes the -p option to mountd.

nfsv4

boolean

If true, enable NFSv4. Otherwise, use NFSv3.

Deprecated. Use `protocols` instead.

Choices:

  • false

  • true

protocols

list / elements=string

List of supported protocols. The elements are any of `nfsv3`, `nfsv4` or their synonyms.

Choices:

  • "nfsv3"

  • "nfsv4"

  • "NFSv3"

  • "NFSv4"

  • "v3"

  • "v4"

rpclockd_port

integer

Specifies the port that rpc.lockd binds to.

This passes the -p option to rpc.lockd.

rpcstatd_port

integer

Specifies the port that rpc.statd binds to.

This passes the -p option to rpc.statd.

servers

integer

The number of NFS servers to create. This value is passed to the -n parameter of nfsd.

statd_lockd_log

boolean

When true, turn on extra logging of rpc.statd and rpc.lockd, for debugging.

Passes the -d flag to rpc.statd and -d 10 to rpc.lockd.

These are debugging flags and are not normally needed.

Choices:

  • false

  • true

udp

boolean

If true, serve UDP clients. Use this if you have NFS clients that have to use UDP.

This sets the -u option to nfsd.

Choices:

  • false

  • true

userd_manage_gids

boolean

Use this when a user is a member of more than 16 groups.

Passes the -manage-gids option to nfsuserd.

Choices:

  • false

  • true

v3owner

string

Enable the NFSv3 ownership model for NFSv4.

Ignored unless NFSv4 is turned on through `protocols` or `nfsv4`.

Examples

- name: Enable UDP
  hosts: nfs_server
  become: yes
  tasks:
    - arensb.truenas.nfs:
        udp: yes

- name: Forbid mount requests from non-root accounts
  hosts: nfs_server
  become: yes
  tasks:
    - arensb.truenas.nfs:
        allow_nonroot: false

- name: Run 32 servers
  hosts: nfs_server
  become: yes
  tasks:
    - arensb.truenas.nfs:
        servers: 32

- name: Enable NFS v3 and v4
  hosts: nfs_server
  become: yes
  tasks:
    - arensb.truenas.nfs:
        protocols:
          - NFSv3
          - NFSv4

- name: Enable v4. Disable v3 if possible.
  hosts: nfs_server
  become: yes
  tasks:
    - arensb.truenas.nfs:
        protocols: NFSv4

# `nfsv4` is deprecated.
- name: Enable NFSv4
  hosts: nfs_server
  become: yes
  tasks:
    - arensb.truenas.nfs:
        nfsv4: yes

- name: Enable NFS v3 ownership model under v4
  hosts: nfs_server
  become: yes
  tasks:
    - arensb.truenas.nfs:
        v3owner: true

- name: Turn on Kerberos
  hosts: nfs_server
  become: yes
  tasks:
    - arensb.truenas.nfs:
        krb: true

- name: Listen on a specific interface

Return Values

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

Key

Description

status

dictionary

A data structure describing the state of the NFS service.

In check_mode and when no changes are needed, this is the current state of the NFS service. When changes have successfully been made, this is the new state of the NFS service.

Returned: success