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 18, 2023
1 parent e0e9142 commit a7e8d3a
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 @@ -4,21 +4,10 @@
name: swap.target
masked: true

# 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 a7e8d3a

Please sign in to comment.