From 5c5826acb6415b8748d730bd01681456825511be Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Sun, 31 May 2020 14:14:58 +0200 Subject: [PATCH] raspi: Disable swap file Raspberry Pi's have enough RAM, let's not prematurely break the SD card. --- roles/raspi/tasks/main.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/roles/raspi/tasks/main.yaml b/roles/raspi/tasks/main.yaml index 8f4a667..8ceaa14 100644 --- a/roles/raspi/tasks/main.yaml +++ b/roles/raspi/tasks/main.yaml @@ -24,3 +24,16 @@ regexp: "^#?display_rotate" when: raspi_rotate_display is defined notify: reboot + +- name: Disable swap + block: + - name: Stop swap service + systemd: + name: dphys-swapfile + state: stopped + enabled: no + + - name: Remove swap file + command: dphys-swapfile uninstall + args: + removes: /var/swap