From e03588f43159a786845dc435fed276367d85e0ad Mon Sep 17 00:00:00 2001 From: hikoz Date: Thu, 14 Feb 2019 19:35:17 +0900 Subject: [PATCH] use swapon -s (#4216) --- roles/kubernetes/preinstall/tasks/0010-swapoff.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/kubernetes/preinstall/tasks/0010-swapoff.yml b/roles/kubernetes/preinstall/tasks/0010-swapoff.yml index ce3d33e8b..81ed421d7 100644 --- a/roles/kubernetes/preinstall/tasks/0010-swapoff.yml +++ b/roles/kubernetes/preinstall/tasks/0010-swapoff.yml @@ -8,6 +8,11 @@ - swap - none +# kubelet fails even if ansible_swaptotal_mb = 0 +- name: check swap + command: /sbin/swapon -s + register: swapon + changed_when: no - name: Disable swap - command: swapoff -a - when: ansible_swaptotal_mb > 0 + command: /sbin/swapoff -a + when: swapon.stdout != ""