mirror of
https://github.com/techno-tim/k3s-ansible.git
synced 2026-08-09 07:23:19 +02:00
feat(prereq): add toggle to disable swap on all cluster nodes (#698)
k3s recommends swap be disabled on every node. Add a disable_swap toggle (default true) to the prereq role that turns swap off now and comments out the swap entries in /etc/fstab so swap stays off across reboots. The change is applied uniformly across all k3s_cluster hosts (all-or-nothing) since leaving swap on for some nodes but not others creates uneven scheduling and latency. - roles/prereq/defaults/main.yml: add disable_swap: true default - roles/prereq/tasks/main.yml: idempotent swapoff -a and fstab comment-out block gated on disable_swap - inventory/sample/group_vars/all.yml: document the new sample variable - README.md: document the disable_swap option - .github/scripts/test-disable-swap.sh: regression test - .pre-commit-config.yaml: wire the test into pre-commit Closes #670
This commit is contained in:
@@ -261,6 +261,7 @@ See the commands [here](https://technotim.com/posts/k3s-etcd-ansible/#testing-yo
|
||||
| `reboot` (playbook) | `concurrent_reboots` | int/string | `100%` | Not required | Number (or percentage) of nodes to reboot at a time for a staggered reboot |
|
||||
| `reboot` (playbook) | `wait_seconds_after_reboot` | int | `0` | Not required | Pause in seconds between staggered reboot batches |
|
||||
| `prereq` | `system_timezone` | string | `null` | Not required | Timezone to be set on all nodes |
|
||||
| `prereq` | `disable_swap` | bool | `true` | Not required | Disable swap on all cluster nodes (swapoff + comment out /etc/fstab swap entries), all-or-nothing |
|
||||
| `proxmox_lxc`, `reset_proxmox_lxc` | `proxmox_lxc_ct_ids` | list | ❌ | Required | Proxmox container ID list |
|
||||
| `raspberrypi` | `state` | string | `present` | Not required | Indicates whether the k3s prerequisites for Raspberry Pi should be set up (possible values are `present` and `absent`) |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user