2018-06-21 06:17:03 +00:00
|
|
|
---
|
|
|
|
- name: Remove swapfile from /etc/fstab
|
|
|
|
mount:
|
2018-12-11 10:42:00 +00:00
|
|
|
name: "{{ item }}"
|
2018-06-21 06:17:03 +00:00
|
|
|
fstype: swap
|
|
|
|
state: absent
|
2018-12-11 10:42:00 +00:00
|
|
|
with_items:
|
|
|
|
- swap
|
|
|
|
- none
|
2018-06-21 06:17:03 +00:00
|
|
|
|
2019-02-14 10:35:17 +00:00
|
|
|
# kubelet fails even if ansible_swaptotal_mb = 0
|
|
|
|
- name: check swap
|
|
|
|
command: /sbin/swapon -s
|
|
|
|
register: swapon
|
|
|
|
changed_when: no
|
2021-11-30 08:52:56 +00:00
|
|
|
|
2018-06-21 06:17:03 +00:00
|
|
|
- name: Disable swap
|
2019-02-14 10:35:17 +00:00
|
|
|
command: /sbin/swapoff -a
|
2021-11-30 08:52:56 +00:00
|
|
|
when:
|
|
|
|
- swapon.stdout
|
|
|
|
- kubelet_fail_swap_on | default(True)
|
2021-07-12 07:00:47 +00:00
|
|
|
ignore_errors: "{{ ansible_check_mode }}" # noqa ignore-errors
|
2021-11-26 17:00:51 +00:00
|
|
|
|
|
|
|
- name: Disable swapOnZram for Fedora
|
|
|
|
command: touch /etc/systemd/zram-generator.conf
|
2021-11-30 08:52:56 +00:00
|
|
|
when:
|
|
|
|
- swapon.stdout
|
|
|
|
- ansible_distribution in ['Fedora']
|
|
|
|
- kubelet_fail_swap_on | default(True)
|