Files
Kamino/roles/nfs_client/meta/argument_specs.yml
T
Dragonish 5ce5e3c932
Build / build (pull_request) Successful in 31s
Molecule / molecule (pull_request) Failing after 43s
Lint / lint (pull_request) Successful in 1m53s
feat(nfs_client): add a role that manages NFS client entries in fstab
Installs nfs-common and manages NFS mount entries from nfs_client_mounts
(src, path, optional opts, state present or absent). Each mount point is
created without owner, group or mode, because once a share is mounted a
chown or chmod there changes the permissions on the NFS server. The role
writes only the fstab line and reloads systemd; it never mounts or
unmounts. An absent entry maps to ansible.posix.mount's absent_from_fstab,
which removes the line and leaves the share and the directory alone.

The default options are _netdev,nofail. x-systemd.automount is left out.

Verified locally: yamllint, ansible-lint (production profile), syntax check
of the scenario playbooks, the controller-side refusals of verify.yml (14
cases, each matched on its own message), and the module's fstab behaviour
against a scratch fstab (replacement, absent_from_fstab, idempotence).
Not verified: Molecule, which runs only in CI; the apt install and the
daemon-reload handler; that systemd generates the mount units in the
scenario's containers.

Refs #402

Assisted-by: Claude Code
2026-11-27 21:47:09 +00:00

58 lines
2.6 KiB
YAML

---
argument_specs:
main:
short_description: Install the NFS client and manage NFS entries in /etc/fstab
description:
- >-
Asserts a Debian-family host, installs C(nfs-common), creates each mount point of a C(present) entry without
owner, group or mode, writes or removes the entry's line in C(/etc/fstab), and reloads systemd after a change
so that the mount unit is generated now. Nothing is mounted.
- >-
It never mounts or unmounts anything. An C(absent) entry only loses its fstab line: the share stays mounted
until it is unmounted or the host reboots, and the mount point is not removed. Needs gathered facts.
options:
nfs_client_mounts:
type: list
elements: dict
default: []
description:
- >-
The NFS mounts to manage. Each mount point may appear once. With the default (no entries) only the client
package is installed.
options:
src:
type: str
required: true
description:
- The export as C(server:/export), one word without spaces.
path:
type: str
required: true
description:
- >-
The mount point: an absolute path without spaces, not C(/) and without a trailing slash. Created, when
the entry is C(present), with no owner, group or mode.
opts:
type: str
description:
- >-
The fstab options, one comma-separated word without spaces. Falls back to C(nfs_client_default_opts)
when left out or empty. Put the NFS version here, for example C(vers=4.2).
state:
type: str
default: present
choices: [present, absent]
description:
- >-
C(present) writes the fstab line. C(absent) removes it and nothing else. The role has no C(mounted),
C(unmounted) or C(remounted): mounting is left to systemd, so that a mount made from a play running in a
private mount namespace (a hardened sshd unit) cannot go unseen by systemd and by containers.
nfs_client_default_opts:
type: str
default: "_netdev,nofail"
description:
- >-
Options for an entry that sets none. C(_netdev) orders the mount after the network and puts it in
C(remote-fs.target); C(nofail) keeps an unreachable server from holding up the boot.
C(x-systemd.automount) is not in the default.