gw5: fs.inotify.max_user_instances 8192 from ansible, as on scout (#598) #360

Open
myagent wants to merge 1 commit from pixel/598-gw5-apsydsn-raise-fs-inotify-max-user into main
Collaborator

dockerd in gw5's runner logged failed to create inotify fd: too many open files on 2026-12-02. The node's fs.inotify.max_user_instances is the default 128; scout's is 8192, set by ansible (dab2fcf).

What changes

  • ansible/hosts.yml: gw5-apsydsn joins the inventory (group gw5, inside a new group sysctl_only) with set_inotify_max_user_instances: 8192.
  • ansible/main.yml: the three sysctl tasks become a play of their own on all hosts. The rest (docker, pip, Alloy, apt, ...) now runs on all:!sysctl_only, so gw5, a k3s node, never gets it, even in a run without --tags.
  • Debian 13 does not read /etc/sysctl.conf at boot, so gw5 writes to /etc/sysctl.d/90-homelab.conf (new variable set_sysctl_file). Other hosts keep /etc/sysctl.conf.
  • Not set on gw5: max_user_watches (762028, already above scout's 524288) and max_queued_events (16384 on both).
  • docs/gw5-sysctl.md: what, why, how to apply and check.

For the other hosts the only change is order: the sysctl tasks run before the roles instead of after Alloy.

After the merge (owner)

cd ansible
./playbook.sh --limit gw5 --tags sysctl -u <user on gw5>

Nothing has been applied to gw5 yet: the value there is still 128.

Checked

With ansible-core 2.19 locally, no host contacted: --syntax-check passes; --list-hosts --limit gw5 gives gw5 in the sysctl play and 0 hosts in the second play; scout's task list is the same set of tasks as before; the inventory gives gw5 only the two variables. The play has not been run against gw5 (no login from here), so become over Tailscale SSH there is untested.

🤖 Generated with Claude Code

dockerd in gw5's runner logged `failed to create inotify fd: too many open files` on 2026-12-02. The node's `fs.inotify.max_user_instances` is the default 128; scout's is 8192, set by ansible (`dab2fcf`). ## What changes - `ansible/hosts.yml`: gw5-apsydsn joins the inventory (group `gw5`, inside a new group `sysctl_only`) with `set_inotify_max_user_instances: 8192`. - `ansible/main.yml`: the three sysctl tasks become a play of their own on all hosts. The rest (docker, pip, Alloy, apt, ...) now runs on `all:!sysctl_only`, so gw5, a k3s node, never gets it, even in a run without `--tags`. - Debian 13 does not read `/etc/sysctl.conf` at boot, so gw5 writes to `/etc/sysctl.d/90-homelab.conf` (new variable `set_sysctl_file`). Other hosts keep `/etc/sysctl.conf`. - Not set on gw5: `max_user_watches` (762028, already above scout's 524288) and `max_queued_events` (16384 on both). - `docs/gw5-sysctl.md`: what, why, how to apply and check. For the other hosts the only change is order: the sysctl tasks run before the roles instead of after Alloy. ## After the merge (owner) ```sh cd ansible ./playbook.sh --limit gw5 --tags sysctl -u <user on gw5> ``` Nothing has been applied to gw5 yet: the value there is still 128. ## Checked With ansible-core 2.19 locally, no host contacted: `--syntax-check` passes; `--list-hosts --limit gw5` gives gw5 in the sysctl play and 0 hosts in the second play; scout's task list is the same set of tasks as before; the inventory gives gw5 only the two variables. The play has not been run against gw5 (no login from here), so `become` over Tailscale SSH there is untested. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
dockerd in gw5's runner logged 'failed to create inotify fd: too many open
files' on 2026-12-02; the node's limit was the default 128, scout's is 8192.

gw5 joins the inventory in a group sysctl_only. The sysctl tasks become a play
of their own on all hosts; the rest of the play (docker, pip, Alloy, ...) skips
that group, because gw5 is a k3s node. Debian 13 does not read /etc/sysctl.conf
at boot, so gw5's value goes to /etc/sysctl.d/90-homelab.conf (set_sysctl_file);
other hosts keep /etc/sysctl.conf.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
pixel-board left a comment

Approve. The change does what #598 asks: gw5 gets fs.inotify.max_user_instances: 8192 in /etc/sysctl.d/90-homelab.conf, so it survives a reboot on Debian 13. max_user_watches and max_queued_events were compared, and leaving them alone is justified.

Checked locally (ansible-core 2.19, roles and collections from requirements.yml, no host contacted)

  • ansible-inventory --graph: gw5 sits only under sysctl_only → gw5.
  • --limit gw5 --list-hosts: gw5 is in play 1; play 2 (all:!sysctl_only) has 0 hosts.
  • --limit scout --tags sysctl --list-tasks: the same three sysctl tasks as before. Play 2 has no sysctl-tagged tasks left.
  • The set_* variables come only from hosts.yml, not from config.yml, so moving the tasks to a play without vars_files loses nothing.
  • ansible.posix 2.2.2's sysctl creates a missing sysctl_file (tempfile in its directory, then an atomic move) and reloads it with sysctl -p <file>, so /etc/sysctl.d/90-homelab.conf does not need to exist first.
  • The doc's references hold: the kube context, deploy/forgejo-runner -c dind (used the same way in other docs), commit dab2fcf, and gw5 being Debian 13 (docs/forgejo-runner-gw5-slow-tests.md).

Still open (needs the node)

  • Whether become works over Tailscale SSH.
  • Whether any file sorting after 90-homelab.conf in /etc/sysctl.d or /usr/lib/sysctl.d also sets max_user_instances.
  • The task's own day-long check of the dind log.

One non-blocking comment on hosts.yml: a full run without --limit now also logs in to gw5.

Review by pixel: task #607, round 1 of 3, commit a77ce6ead6.

Approve. The change does what #598 asks: gw5 gets `fs.inotify.max_user_instances: 8192` in `/etc/sysctl.d/90-homelab.conf`, so it survives a reboot on Debian 13. `max_user_watches` and `max_queued_events` were compared, and leaving them alone is justified. **Checked locally** (ansible-core 2.19, roles and collections from `requirements.yml`, no host contacted) - `ansible-inventory --graph`: gw5 sits only under `sysctl_only` → `gw5`. - `--limit gw5 --list-hosts`: gw5 is in play 1; play 2 (`all:!sysctl_only`) has 0 hosts. - `--limit scout --tags sysctl --list-tasks`: the same three sysctl tasks as before. Play 2 has no sysctl-tagged tasks left. - The `set_*` variables come only from `hosts.yml`, not from `config.yml`, so moving the tasks to a play without `vars_files` loses nothing. - `ansible.posix` 2.2.2's `sysctl` creates a missing `sysctl_file` (tempfile in its directory, then an atomic move) and reloads it with `sysctl -p <file>`, so `/etc/sysctl.d/90-homelab.conf` does not need to exist first. - The doc's references hold: the kube context, `deploy/forgejo-runner -c dind` (used the same way in other docs), commit `dab2fcf`, and gw5 being Debian 13 (`docs/forgejo-runner-gw5-slow-tests.md`). **Still open** (needs the node) - Whether `become` works over Tailscale SSH. - Whether any file sorting after `90-homelab.conf` in `/etc/sysctl.d` or `/usr/lib/sysctl.d` also sets `max_user_instances`. - The task's own day-long check of the dind log. One non-blocking comment on `hosts.yml`: a full run without `--limit` now also logs in to gw5. Review by pixel: task #607, round 1 of 3, commit a77ce6ead64c214ded74f5c45d8a91f4b1985b86.
@ -12,0 +14,4 @@
# known here; pass -u <user> or set ansible_user before running.
gw5:
hosts:
gw5-apsydsn.tuatara-puffin.ts.net:
Collaborator

Not blocking. gw5 is now in all, so the sysctl play includes it whenever ./playbook.sh runs without --limit. With no ansible_user here, ansible logs in to gw5 as the local user. If that login or become fails, gw5 shows as unreachable or failed and the run exits non-zero, though the other hosts still get every task. -u does not change the other hosts, because their inventory ansible_user: patrick takes precedence over it. Once the owner has run the play and knows the login user, consider setting ansible_user here (and ansible_become_password/-K in the doc if sudo asks for one), so that a routine full run stays clean. If not, add a line to docs/gw5-sysctl.md saying that a full run needs -u <user> too or should use --limit '!gw5'.

Not blocking. gw5 is now in `all`, so the sysctl play includes it whenever `./playbook.sh` runs without `--limit`. With no `ansible_user` here, ansible logs in to gw5 as the local user. If that login or `become` fails, gw5 shows as unreachable or failed and the run exits non-zero, though the other hosts still get every task. `-u` does not change the other hosts, because their inventory `ansible_user: patrick` takes precedence over it. Once the owner has run the play and knows the login user, consider setting `ansible_user` here (and `ansible_become_password`/`-K` in the doc if sudo asks for one), so that a routine full run stays clean. If not, add a line to `docs/gw5-sysctl.md` saying that a full run needs `-u <user>` too or should use `--limit '!gw5'`.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'pixel/598-gw5-apsydsn-raise-fs-inotify-max-user:pixel/598-gw5-apsydsn-raise-fs-inotify-max-user'
git switch 'pixel/598-gw5-apsydsn-raise-fs-inotify-max-user'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'pixel/598-gw5-apsydsn-raise-fs-inotify-max-user'
git switch 'pixel/598-gw5-apsydsn-raise-fs-inotify-max-user'
git rebase 'main'
git switch 'main'
git merge --ff-only 'pixel/598-gw5-apsydsn-raise-fs-inotify-max-user'
git switch 'pixel/598-gw5-apsydsn-raise-fs-inotify-max-user'
git rebase 'main'
git switch 'main'
git merge --no-ff 'pixel/598-gw5-apsydsn-raise-fs-inotify-max-user'
git switch 'main'
git merge --squash 'pixel/598-gw5-apsydsn-raise-fs-inotify-max-user'
git switch 'main'
git merge --ff-only 'pixel/598-gw5-apsydsn-raise-fs-inotify-max-user'
git switch 'main'
git merge 'pixel/598-gw5-apsydsn-raise-fs-inotify-max-user'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sophie/homelab!360
No description provided.