1
0
Fork 0

Add a role to reconfigure raspberry pi swap

This commit is contained in:
Daniele Tricoli 2020-10-07 16:30:14 +02:00
parent 0f62ef5fbb
commit 4b3b6cacf8
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,3 @@
---
rpi_swap_size: 1024
rpi_swap_reboot: true

View File

@ -0,0 +1,19 @@
---
- name: swapoff the current swap file
command: dphys-swapfile swapoff
- name: set the swap size to {{ rpi_swap_size }}
lineinfile:
path: /etc/dphys-swapfile
regexp: "^CONF_SWAPSIZE"
line: "CONF_SWAPSIZE={{ rpi_swap_size }}"
- name: re-initialize swap file
command: dphys-swapfile setup
- name: swapon the swap file
command: dphys-swapfile swapon
- name: reboot the raspberry pi
command: reboot
when: rpi_swap_reboot