mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-10 12:47:04 +00:00
A production redeploy of echoserver hung at the swap-forge task and the host stopped answering SSH. swap-forge v1.0.1 recreates the swapfile whenever its size differs from the requested MiB by any amount, starting with swapoff on the live file. The request is the host's MemTotal, which drifts by a few MiB across kernels, so a routine deploy paged the whole swap back in, charged it to the containers' memory cgroups and starved sshd until the OOM killer took swapoff. Read the active swap files with swapon before swap-forge runs and skip it when an active file is within 5 % of the requested size, reporting the kept size against the request. The sizing formula is unchanged, so no host is forced into a one-time recreate; a deliberate resize beyond the tolerance still reaches swap-forge. The unit test resolves the real vars through Ansible's Templar for MiB drift both ways, no swap, zram and partitions, a halved size, an exact pin, a lowercase unit and an escaped file name, and shows that the exact MiB comparison swap-forge uses misses the drift. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>