swap: make it idempotent

Call 'swapon -a' only when we just added the swap /etc/fstab entry.
This commit is contained in:
Pavel Raiskup 2020-03-17 10:11:26 +01:00 committed by Pierre-Yves Chibon
parent a9da2ee4d9
commit 2a4698ee3a

View file

@ -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