Merge "configure-swap: Always use dd and limit swap size to 1024MB"

This commit is contained in:
Zuul 2020-09-10 20:05:22 +00:00 committed by Gerrit Code Review
commit d68d355170
2 changed files with 2 additions and 11 deletions

View File

@ -1,2 +1,2 @@
# Default swap partition/file size, in MiB
configure_swap_size: 8192
configure_swap_size: 1024

View File

@ -20,21 +20,12 @@
# Note, we don't use a sparse device to avoid wedging when disk space
# and memory are both unavailable.
# Cannot fallocate on filesystems like XFS, so use slower dd
- name: Create swap backing file for non-EXT fs
when: '"ext" not in root_filesystem'
- name: Create swap backing file
become: yes
command: dd if=/dev/zero of=/root/swapfile bs=1M count={{ swap_required }}
args:
creates: /root/swapfile
- name: Create sparse swap backing file for EXT fs
when: '"ext" in root_filesystem'
become: yes
command: fallocate -l {{ swap_required }}M /root/swapfile
args:
creates: /root/swapfile
- name: Ensure swapfile perms
become: yes
file: