Inputs:nfs_client_mounts (a list of src, path, optional opts, statepresent or absent) and nfs_client_default_opts (default _netdev,nofail; x-systemd.automount is left to the host that wants it).
No owner, group or mode on the mount point: once a share is mounted the path is the export root, and a chown or chmod there changes the permissions on the NFS server. A new directory gets the system defaults and an existing one is left as it is.
fstab only:present writes the line, absent maps to ansible.posix.mount's absent_from_fstab, which removes the line and leaves the share and the directory alone. The module's own absent would also unmount and delete the mount point. A handler reloads systemd after a change.
No new dependency:ansible.posix >=2.2.0 is already in galaxy.yml; the pull request only names nfs_client in the comment above it.
Platforms: Ubuntu noble and resolute, the platforms the scenario runs on. Debian trixie is listed under "Untested platforms" in the README until the Debian image (#226) exists.
Changelog fragment 402-nfs-client.yml (minor_changes); the role is added to the role lists in README.md and galaxy.yml. It is not on the Roadmap list.
Verified
yamllint and ansible-lint (profile production) pass on roles/nfs_client; all commit-stage hooks passed; ansible-test sanity passed in the pre-push hook; ansible-playbook --syntax-check passes for the scenario's converge.yml, prepare.yml and verify.yml.
The role's validation, run on a controller against localhost with Ansible's own engine, for 17 inputs: the entries come out as a list, defaults and an empty opts fall back correctly, and every refusal carries its own message. This found three defects before the push: the resolved entries were a string, a looped assert hid its message, and an IPv6 server was rejected.
The controller-side refusals of verify.yml (14 cases, run once on localhost in check mode, as in the other roles) each matched their expected message when run against localhost: 14 rescued, 0 failed.
ansible.posix.mount behaviour against a scratch fstab with the same parameters as the role: a seeded line for the same path with another server is replaced once, an absent entry loses its line only (its directory and the file in it stay), and a second pass reports changed=False for every task.
An independent read-only review of the role against roles/AGENTS.md; its findings are fixed in this branch.
Molecule, run 6331 on head fcd2290 (run): the whole sequence passed on noble and resolute: syntax, create, prepare, check on a fresh host, converge, check on the configured host, idempotence and verify. That covers the nfs-common install, the fstab fields, the unchanged owner and mode of an existing mount point, nothing mounted, and the daemon-reload handler: systemd has a mount unit for each new entry and none for the removed one. Lint and Build passed too.
The first Molecule run failed in the fresh-host check, because the image ships without apt lists and --check does not refresh them (No package matching 'nfs-common' is available). fcd2290 refreshes the cache in prepare.yml, as the docker, pihole, system_baseline and traefik scenarios do.
Not verified
A real share: the server in the scenario does not exist, so nothing is ever mounted. Options other than the defaults and x-systemd.automount were not tried. Debian trixie is untested.
The permission note for a mounted share whose server is gone is reasoned, not tested.
I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.
Assisted-by: Claude Code
## What and why
Adds the `nfs_client` role proposed in #402: it installs `nfs-common` and manages NFS mount entries in `/etc/fstab`. It never mounts or unmounts anything.
Refs #402
- **Inputs:** `nfs_client_mounts` (a list of `src`, `path`, optional `opts`, `state` `present` or `absent`) and `nfs_client_default_opts` (default `_netdev,nofail`; `x-systemd.automount` is left to the host that wants it).
- **No owner, group or mode on the mount point:** once a share is mounted the path is the export root, and a `chown` or `chmod` there changes the permissions on the NFS server. A new directory gets the system defaults and an existing one is left as it is.
- **fstab only:** `present` writes the line, `absent` maps to `ansible.posix.mount`'s `absent_from_fstab`, which removes the line and leaves the share and the directory alone. The module's own `absent` would also unmount and delete the mount point. A handler reloads systemd after a change.
- **No new dependency:** `ansible.posix >=2.2.0` is already in `galaxy.yml`; the pull request only names `nfs_client` in the comment above it.
- **Platforms:** Ubuntu noble and resolute, the platforms the scenario runs on. Debian trixie is listed under "Untested platforms" in the README until the Debian image (#226) exists.
- Changelog fragment `402-nfs-client.yml` (`minor_changes`); the role is added to the role lists in `README.md` and `galaxy.yml`. It is not on the Roadmap list.
## Verified
- `yamllint` and `ansible-lint` (profile `production`) pass on `roles/nfs_client`; all commit-stage hooks passed; `ansible-test sanity` passed in the pre-push hook; `ansible-playbook --syntax-check` passes for the scenario's `converge.yml`, `prepare.yml` and `verify.yml`.
- The role's validation, run on a controller against localhost with Ansible's own engine, for 17 inputs: the entries come out as a list, defaults and an empty `opts` fall back correctly, and every refusal carries its own message. This found three defects before the push: the resolved entries were a string, a looped `assert` hid its message, and an IPv6 server was rejected.
- The controller-side refusals of `verify.yml` (14 cases, run once on localhost in check mode, as in the other roles) each matched their expected message when run against localhost: 14 rescued, 0 failed.
- `ansible.posix.mount` behaviour against a scratch fstab with the same parameters as the role: a seeded line for the same path with another server is replaced once, an `absent` entry loses its line only (its directory and the file in it stay), and a second pass reports `changed=False` for every task.
- An independent read-only review of the role against `roles/AGENTS.md`; its findings are fixed in this branch.
- **Molecule, run 6331 on head `fcd2290` ([run](https://git.rkdr.net/Mortis/Kamino/actions/runs/6331)):** the whole sequence passed on noble and resolute: syntax, create, prepare, check on a fresh host, converge, check on the configured host, idempotence and verify. That covers the `nfs-common` install, the fstab fields, the unchanged owner and mode of an existing mount point, nothing mounted, and the `daemon-reload` handler: systemd has a mount unit for each new entry and none for the removed one. Lint and Build passed too.
- The first Molecule run failed in the fresh-host check, because the image ships without apt lists and `--check` does not refresh them (`No package matching 'nfs-common' is available`). `fcd2290` refreshes the cache in `prepare.yml`, as the docker, pihole, system_baseline and traefik scenarios do.
## Not verified
- A real share: the server in the scenario does not exist, so nothing is ever mounted. Options other than the defaults and `x-systemd.automount` were not tried. Debian trixie is untested.
- The permission note for a mounted share whose server is gone is reasoned, not tested.
---
- [ ] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none.
Assisted-by: Claude Code
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
CODEOWNERS rules
requested review from Defame1297 2026-11-27 21:50:46 +00:00
Molecule fails on the first check step on both platforms: No package matching 'nfs-common' is available. Check mode doesn't refresh the apt cache, and the test images ship without package lists, so the install task can't see the package.
The other roles that install packages refresh the cache in prepare.yml (see roles/docker/molecule/default/prepare.yml). Adding this as the first task of roles/nfs_client/molecule/default/prepare.yml should fix it:
# check runs before converge, so the cache must already list the packages the role installs.- name:Refresh the apt cacheansible.builtin.apt:update_cache:true
Assisted-by: Claude Code
Molecule fails on the first `check` step on both platforms: `No package matching 'nfs-common' is available`. Check mode doesn't refresh the apt cache, and the test images ship without package lists, so the install task can't see the package.
The other roles that install packages refresh the cache in `prepare.yml` (see `roles/docker/molecule/default/prepare.yml`). Adding this as the first task of `roles/nfs_client/molecule/default/prepare.yml` should fix it:
```yaml
# check runs before converge, so the cache must already list the packages the role installs.
- name: Refresh the apt cache
ansible.builtin.apt:
update_cache: true
```
Assisted-by: Claude Code
The molecule image ships without apt lists, and --check does not refresh
them, so the fresh-host check found no nfs-common to install and failed
with "No package matching 'nfs-common' is available". The docker, pihole,
system_baseline and traefik scenarios refresh the cache in prepare for the
same reason.
Refs #402
Assisted-by: Claude Code
Dragonish
scheduled this pull request to auto merge when all checks succeed 2026-11-27 22:06:13 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What and why
Adds the
nfs_clientrole proposed in #402: it installsnfs-commonand manages NFS mount entries in/etc/fstab. It never mounts or unmounts anything.Refs #402
nfs_client_mounts(a list ofsrc,path, optionalopts,statepresentorabsent) andnfs_client_default_opts(default_netdev,nofail;x-systemd.automountis left to the host that wants it).chownorchmodthere changes the permissions on the NFS server. A new directory gets the system defaults and an existing one is left as it is.presentwrites the line,absentmaps toansible.posix.mount'sabsent_from_fstab, which removes the line and leaves the share and the directory alone. The module's ownabsentwould also unmount and delete the mount point. A handler reloads systemd after a change.ansible.posix >=2.2.0is already ingalaxy.yml; the pull request only namesnfs_clientin the comment above it.402-nfs-client.yml(minor_changes); the role is added to the role lists inREADME.mdandgalaxy.yml. It is not on the Roadmap list.Verified
yamllintandansible-lint(profileproduction) pass onroles/nfs_client; all commit-stage hooks passed;ansible-test sanitypassed in the pre-push hook;ansible-playbook --syntax-checkpasses for the scenario'sconverge.yml,prepare.ymlandverify.yml.optsfall back correctly, and every refusal carries its own message. This found three defects before the push: the resolved entries were a string, a loopedasserthid its message, and an IPv6 server was rejected.verify.yml(14 cases, run once on localhost in check mode, as in the other roles) each matched their expected message when run against localhost: 14 rescued, 0 failed.ansible.posix.mountbehaviour against a scratch fstab with the same parameters as the role: a seeded line for the same path with another server is replaced once, anabsententry loses its line only (its directory and the file in it stay), and a second pass reportschanged=Falsefor every task.roles/AGENTS.md; its findings are fixed in this branch.fcd2290(run): the whole sequence passed on noble and resolute: syntax, create, prepare, check on a fresh host, converge, check on the configured host, idempotence and verify. That covers thenfs-commoninstall, the fstab fields, the unchanged owner and mode of an existing mount point, nothing mounted, and thedaemon-reloadhandler: systemd has a mount unit for each new entry and none for the removed one. Lint and Build passed too.--checkdoes not refresh them (No package matching 'nfs-common' is available).fcd2290refreshes the cache inprepare.yml, as the docker, pihole, system_baseline and traefik scenarios do.Not verified
x-systemd.automountwere not tried. Debian trixie is untested.NOTICEandREUSE.toml, or there is none.Assisted-by: Claude Code
Molecule fails on the first
checkstep on both platforms:No package matching 'nfs-common' is available. Check mode doesn't refresh the apt cache, and the test images ship without package lists, so the install task can't see the package.The other roles that install packages refresh the cache in
prepare.yml(seeroles/docker/molecule/default/prepare.yml). Adding this as the first task ofroles/nfs_client/molecule/default/prepare.ymlshould fix it:Assisted-by: Claude Code