Skip to content

Commit e9d84fd

Browse files
authored
fix(#564): make swap config one shot (#565)
1 parent 7fcd4a3 commit e9d84fd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

salt/base/swap.sls

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
{{ swap_path }}:
77
cmd.run:
88
- name: |
9-
swapon --show=NAME --noheadings | grep -q "^{{ swap_path }}$" && swapoff {{ swap_path }}
10-
rm -f {{ swap_path }}
119
fallocate -l {{ swap_size }}M {{ swap_path }}
1210
chmod 0600 {{ swap_path }}
1311
mkswap {{ swap_path }}
14-
- unless: bash -c "[[ $(($(stat -c %s {{ swap_path }}) / 1024**2)) = {{ swap_size }} ]]"
12+
swapon {{ swap_path }}
13+
- unless: test -f {{ swap_path }}
1514

1615
mount.swap:
1716
- persist: true

0 commit comments

Comments
 (0)