From bbf645e6bf979ce53a26fa8db7f7362acfe67305 Mon Sep 17 00:00:00 2001 From: exu Date: Mon, 14 Oct 2024 21:07:54 +0200 Subject: [PATCH] Add zram generator automation --- .../files/etc/systemd/zram-generator.conf | 3 +++ roles/config/tasks/main.yml | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 roles/config/files/etc/systemd/zram-generator.conf diff --git a/roles/config/files/etc/systemd/zram-generator.conf b/roles/config/files/etc/systemd/zram-generator.conf new file mode 100644 index 00000000..dd997c96 --- /dev/null +++ b/roles/config/files/etc/systemd/zram-generator.conf @@ -0,0 +1,3 @@ +[zram0] +zram-size = ram / 2 +compression-algorithm = zstd diff --git a/roles/config/tasks/main.yml b/roles/config/tasks/main.yml index 41ad02e7..8eee9884 100644 --- a/roles/config/tasks/main.yml +++ b/roles/config/tasks/main.yml @@ -111,6 +111,12 @@ scope: user tags: services +- name: Reload system systemd services + ansible.builtin.systemd_service: + daemon_reload: true + become: true + tags: services + - name: Enable fstrim ansible.builtin.systemd_service: name: fstrim.timer @@ -119,6 +125,17 @@ become: true tags: services +- name: Enable zram generator + ansible.builtin.systemd_service: + name: "systemd-zram-setup@zram0.service" + state: "started" + enabled: true + when: + - ('zram-generator' in ansible_facts.packages) + - ('zswap.enabled=0' in {{ lookup('ansible.builtin.file', '/proc/cmdline') }}) + become: true + tags: services + - name: Enable btrfsmaintenance timers ansible.builtin.systemd_service: name: "{{ item }}"