-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0957b4c
commit 1bffdd8
Showing
4 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# When the computer doesn't have enough RAM to hold everything it needs, | ||
# it can move some it doesn't need immediately to the hard drive. | ||
# It's incredibly slow, but it's usually considered better than the computer crashing. | ||
# This is required by many simulation codes. | ||
# see: https://www.techtarget.com/searchwindowsserver/definition/swap-file-swap-space-or-pagefile | ||
# note this can not be added in a container, since there the underlying OS handles memory | ||
|
||
- name: "Check if swapfile exists" | ||
stat: path=/swapfile | ||
register: swapfile_stat | ||
|
||
- block: | ||
|
||
- name: "Create swapfile" | ||
become: true | ||
command: "dd if=/dev/zero of=/swapfile bs=1M count=1024" | ||
|
||
- name: "Make the swapfile a valid swap" | ||
become: true | ||
command: "mkswap /swapfile" | ||
|
||
- name: "Use the swapfile" | ||
become: true | ||
command: "swapon /swapfile" | ||
|
||
- name: "Put a line in fstab to ensure swap is used at boot time" | ||
become: true | ||
lineinfile: | ||
path: "/etc/fstab" | ||
line: "/swapfile swap swap defaults 0 0" | ||
|
||
when: not swapfile_stat.stat.exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters