From 2a4698ee3a555e94e93c27d0a0a8724bdd0736d0 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Tue, 17 Mar 2020 10:11:26 +0100 Subject: [PATCH] swap: make it idempotent Call 'swapon -a' only when we just added the swap /etc/fstab entry. --- tasks/swap.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/swap.yml b/tasks/swap.yml index bc0ade3f16..3297eedaa0 100644 --- a/tasks/swap.yml +++ b/tasks/swap.yml @@ -45,6 +45,7 @@ passno=0 dump=0 state=present + register: swap_fstab_added tags: - swap.fstab - swap @@ -52,6 +53,7 @@ - name: Mount swap command: "swapon -a" #when: ansible_swaptotal_mb|int < 1 + when: swap_fstab_added.changed tags: - swap.file.swapon - swap