mirror of
https://github.com/kasmtech/ansible
synced 2025-01-09 18:28:45 +00:00
26 lines
640 B
YAML
26 lines
640 B
YAML
|
- name: Create swap file
|
||
|
# We can't use falloc because it creates "file with holes"
|
||
|
# https://man.archlinux.org/man/swapon.8#Files_with_holes
|
||
|
command: "dd if=/dev/zero bs=1M count={{ (new_swap_size | int / 1024 / 1024) | int }} of=/mnt/kasm.swap"
|
||
|
become: true
|
||
|
|
||
|
- name: Set swapfile permissions
|
||
|
file:
|
||
|
path: /mnt/kasm.swap
|
||
|
mode: 0600
|
||
|
become: true
|
||
|
|
||
|
- name: Run mkswap command
|
||
|
command: mkswap /mnt/kasm.swap
|
||
|
become: true
|
||
|
|
||
|
- name: Mount swap on boot
|
||
|
lineinfile:
|
||
|
path: /etc/fstab
|
||
|
line: "/mnt/kasm.swap swap swap defaults 0 0"
|
||
|
become: true
|
||
|
|
||
|
- name: Run swapon
|
||
|
command: swapon /mnt/kasm.swap
|
||
|
become: true
|
||
|
|