Skip to content
Snippets Groups Projects
Commit 3b4fe91a authored by Jörg Sachse's avatar Jörg Sachse
Browse files

fix: configure udev rule to make zram swap reboot persistent

parent b47e36ac
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
# RHEL part is based on https://www.techrepublic.com/article/how-to-enable-zram-rocky-linux/ # RHEL part is based on https://www.techrepublic.com/article/how-to-enable-zram-rocky-linux/
# Note: all that udev stuff from that guide doesn't work. We'll use CLI commands.
# More docu on zram at https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html # More docu on zram at https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html
- name: configure zram based swap (RedHat) - name: configure zram based swap (RedHat)
block: block:
...@@ -41,6 +40,12 @@ ...@@ -41,6 +40,12 @@
create: true create: true
line: "options zram num_devices=1" line: "options zram num_devices=1"
mode: "0644" mode: "0644"
- name: configure udev to initialise zram device on bootup
ansible.builtin.lineinfile:
path: "/etc/udev/rules.d/99-zram.rules"
create: true
line: "KERNEL==\"zram0\", ATTR{disksize}=\"{{ ( ansible_facts.memtotal_mb / 2 ) | round | int }}M\",TAG+=\"systemd\""
mode: "0644"
- name: find out if zram Kernel module has been loaded already - name: find out if zram Kernel module has been loaded already
ansible.builtin.command: "lsmod" ansible.builtin.command: "lsmod"
register: kernel_modules register: kernel_modules
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment