c12s-kubespray/roles/kubernetes/preinstall/tasks/0010-swapoff.yml

30 lines
669 B
YAML
Raw Permalink Normal View History

2018-06-21 06:17:03 +00:00
---
- name: Remove swapfile from /etc/fstab
mount:
name: "{{ item }}"
2018-06-21 06:17:03 +00:00
fstype: swap
state: absent
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
2018-06-21 06:17:03 +00:00
- name: Disable swap
2019-02-14 10:35:17 +00:00
command: /sbin/swapoff -a
when:
- swapon.stdout
- kubelet_fail_swap_on | default(True)
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']
- kubelet_fail_swap_on | default(True)