Skip to content

Commit

Permalink
Unconditionally disable swap
Browse files Browse the repository at this point in the history
We only care to disable it (the "swapon" registered variable is not used
anywhere else.
This allows to get rid of the ignore_errors, since this was added
because swapon.stdout does not exist in check_mode (see issue #6642).
  • Loading branch information
VannTen committed Nov 3, 2023
1 parent 31b0c03 commit 6791f95
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions roles/kubernetes/preinstall/tasks/0010-swapoff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,10 @@
masked: true
when: ansible_service_mgr is 'systemd'

# kubelet fails even if ansible_swaptotal_mb = 0
- name: Check swap
command: /sbin/swapon -s
register: swapon
changed_when: no

- name: Disable swap
command: /sbin/swapoff -a
when:
- swapon.stdout
ignore_errors: "{{ ansible_check_mode }}" # noqa ignore-errors

- name: Disable swapOnZram for Fedora
command: touch /etc/systemd/zram-generator.conf
when:
- swapon.stdout
- ansible_distribution in ['Fedora']
ignore_errors: "{{ ansible_check_mode }}" # noqa ignore-errors

0 comments on commit 6791f95

Please sign in to comment.