A guest that mounts NFS shares usually declares them in /etc/fstab. No role in the Collection does this today, so every consumer hand-writes mount tasks, and the easy way to write them is wrong in two ways that are not visible in a dry run:
ansible.posix.mount with state: mounted (or remounted) mounts inside the mount namespace of the SSH session Ansible runs in. systemd (PID 1) and containers do not see that mount. state: present edits /etc/fstab only and is the safe choice, at the price that the new options apply at the next boot (a container holding the old mount keeps it alive).
Giving the mount point an owner, group or mode is harmful once the share is mounted: the path is then the export root, and a chown/chmod changes permissions on the NFS server.
This is a scope question, not a request to build anything yet: is this something the maintainer wants in the Collection, and if so as a new role or as part of an existing one?
Out of scope: NFS server setup, autofs, CIFS/SMB, Kerberos, and mounting a share now (only the fstab entry).
Proposal
If the answer is yes, one possible shape, for discussion. A role nfs_client (name open; system_baseline is an alternative but this is not OS baseline policy) with:
nfs_client_mounts:# list, default []- src:nas.example:/export/datapath:/mnt/dataopts:"..."# optional; falls back to nfs_client_default_optsstate:present # present (default) or absentnfs_client_default_opts:"_netdev,nofail,x-systemd.automount"# placeholder; the maintainer decides defaults
Behaviour: install the NFS client package; create each mount point with no owner, group or mode; manage the fstab line with state: present/absent only, never mounted; dump/passno 0; reload systemd after an fstab change; refuse mounted/remounted and an empty src or relative path in validate.yml. Requires ansible.posix as a Collection dependency (with a version floor and a stated reason, per making-a-change.md). Roadmap: the role would be added to the README list by the pull request that creates it.
Questions: (1) in scope at all? (2) role name and whether ansible.posix may become a dependency? (3) which default mount options are acceptable? (4) should the role also be able to wait for a mount, or stay fstab-only?
Acceptance criteria
The maintainer states in a comment whether NFS client mounts are in scope, and under which role name. Check: a comment on this issue.
If yes: a follow-up feature issue with the interface agreed here, filed on the same template. Check: the follow-up issue exists and links this one.
If no: the issue is closed with the reason. Check: closing comment.
This is the contributor's own design and is offered under GPL-3.0-or-later, the Collection's licence.
Assisted-by: Claude Code
### Problem
A guest that mounts NFS shares usually declares them in `/etc/fstab`. No role in the Collection does this today, so every consumer hand-writes `mount` tasks, and the easy way to write them is wrong in two ways that are not visible in a dry run:
- `ansible.posix.mount` with `state: mounted` (or `remounted`) mounts inside the mount namespace of the SSH session Ansible runs in. systemd (PID 1) and containers do not see that mount. `state: present` edits `/etc/fstab` only and is the safe choice, at the price that the new options apply at the next boot (a container holding the old mount keeps it alive).
- Giving the mount point an owner, group or mode is harmful once the share is mounted: the path is then the export root, and a `chown`/`chmod` changes permissions on the NFS server.
This is a scope question, not a request to build anything yet: is this something the maintainer wants in the Collection, and if so as a new role or as part of an existing one?
Out of scope: NFS server setup, autofs, CIFS/SMB, Kerberos, and mounting a share now (only the fstab entry).
### Proposal
If the answer is yes, one possible shape, for discussion. A role `nfs_client` (name open; `system_baseline` is an alternative but this is not OS baseline policy) with:
```yaml
nfs_client_mounts: # list, default []
- src: nas.example:/export/data
path: /mnt/data
opts: "..." # optional; falls back to nfs_client_default_opts
state: present # present (default) or absent
nfs_client_default_opts: "_netdev,nofail,x-systemd.automount" # placeholder; the maintainer decides defaults
```
Behaviour: install the NFS client package; create each mount point with no owner, group or mode; manage the fstab line with `state: present`/`absent` only, never `mounted`; `dump`/`passno` 0; reload systemd after an fstab change; refuse `mounted`/`remounted` and an empty `src` or relative `path` in `validate.yml`. Requires `ansible.posix` as a Collection dependency (with a version floor and a stated reason, per making-a-change.md). Roadmap: the role would be added to the README list by the pull request that creates it.
Questions: (1) in scope at all? (2) role name and whether `ansible.posix` may become a dependency? (3) which default mount options are acceptable? (4) should the role also be able to wait for a mount, or stay fstab-only?
### Acceptance criteria
- [ ] The maintainer states in a comment whether NFS client mounts are in scope, and under which role name. Check: a comment on this issue.
- [ ] If yes: a follow-up feature issue with the interface agreed here, filed on the same template. Check: the follow-up issue exists and links this one.
- [ ] If no: the issue is closed with the reason. Check: closing comment.
This is the contributor's own design and is offered under GPL-3.0-or-later, the Collection's licence.
Assisted-by: Claude Code
Recommendation: a new role nfs_client, not part of system_baseline.
Why a separate role: mounting shares is consumer policy, not OS baseline. A host that has no shares should not carry the role at all. system_baseline would also need NFS-specific arguments and verification that most hosts never use.
Dependency: none to add. ansible.posix >=2.2.0 is already in galaxy.yml, so ansible.posix.mount with state: present is available.
Scope: keep it fstab-only (our question 4). Waiting for a mount is a separate concern, and a role that mounts now brings back the mount-namespace problem from the issue.
Defaults:_netdev,nofail only. I'd leave x-systemd.automount out of the default, because it changes when a mount appears and can hide an unreachable server until first access. A host can opt in per mount.
Interaction to document:docker_stop_at_shutdown already relies on remote-fs.target ordering. _netdev is what puts a mount in that target, so the README should link the two roles.
If you agree, I'll file the follow-up feature issue with the interface from this issue (acceptance criterion 2), and no code until you mark it Ready for Agent.
Assisted-by: Claude Code
**Recommendation: a new role `nfs_client`, not part of `system_baseline`.**
- **Why a separate role:** mounting shares is consumer policy, not OS baseline. A host that has no shares should not carry the role at all. `system_baseline` would also need NFS-specific arguments and verification that most hosts never use.
- **Dependency:** none to add. `ansible.posix >=2.2.0` is already in `galaxy.yml`, so `ansible.posix.mount` with `state: present` is available.
- **Scope:** keep it fstab-only (our question 4). Waiting for a mount is a separate concern, and a role that mounts now brings back the mount-namespace problem from the issue.
- **Defaults:** `_netdev,nofail` only. I'd leave `x-systemd.automount` out of the default, because it changes when a mount appears and can hide an unreachable server until first access. A host can opt in per mount.
- **Interaction to document:** `docker_stop_at_shutdown` already relies on `remote-fs.target` ordering. `_netdev` is what puts a mount in that target, so the README should link the two roles.
If you agree, I'll file the follow-up feature issue with the interface from this issue (acceptance criterion 2), and no code until you mark it Ready for Agent.
Assisted-by: Claude Code
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.
Problem
A guest that mounts NFS shares usually declares them in
/etc/fstab. No role in the Collection does this today, so every consumer hand-writesmounttasks, and the easy way to write them is wrong in two ways that are not visible in a dry run:ansible.posix.mountwithstate: mounted(orremounted) mounts inside the mount namespace of the SSH session Ansible runs in. systemd (PID 1) and containers do not see that mount.state: presentedits/etc/fstabonly and is the safe choice, at the price that the new options apply at the next boot (a container holding the old mount keeps it alive).chown/chmodchanges permissions on the NFS server.This is a scope question, not a request to build anything yet: is this something the maintainer wants in the Collection, and if so as a new role or as part of an existing one?
Out of scope: NFS server setup, autofs, CIFS/SMB, Kerberos, and mounting a share now (only the fstab entry).
Proposal
If the answer is yes, one possible shape, for discussion. A role
nfs_client(name open;system_baselineis an alternative but this is not OS baseline policy) with:Behaviour: install the NFS client package; create each mount point with no owner, group or mode; manage the fstab line with
state: present/absentonly, nevermounted;dump/passno0; reload systemd after an fstab change; refusemounted/remountedand an emptysrcor relativepathinvalidate.yml. Requiresansible.posixas a Collection dependency (with a version floor and a stated reason, per making-a-change.md). Roadmap: the role would be added to the README list by the pull request that creates it.Questions: (1) in scope at all? (2) role name and whether
ansible.posixmay become a dependency? (3) which default mount options are acceptable? (4) should the role also be able to wait for a mount, or stay fstab-only?Acceptance criteria
This is the contributor's own design and is offered under GPL-3.0-or-later, the Collection's licence.
Assisted-by: Claude Code
@Dragonish make a new nfs role maybe? What does Claude think?
Recommendation: a new role
nfs_client, not part ofsystem_baseline.system_baselinewould also need NFS-specific arguments and verification that most hosts never use.ansible.posix >=2.2.0is already ingalaxy.yml, soansible.posix.mountwithstate: presentis available._netdev,nofailonly. I'd leavex-systemd.automountout of the default, because it changes when a mount appears and can hide an unreachable server until first access. A host can opt in per mount.docker_stop_at_shutdownalready relies onremote-fs.targetordering._netdevis what puts a mount in that target, so the README should link the two roles.If you agree, I'll file the follow-up feature issue with the interface from this issue (acceptance criterion 2), and no code until you mark it Ready for Agent.
Assisted-by: Claude Code