Skip to content

Instantly share code, notes, and snippets.

@bluedevilx
Forked from fungiboletus/zram-earlyoom.yaml
Created October 22, 2025 00:31
Show Gist options
  • Select an option

  • Save bluedevilx/89fdf71e7354e03507da44ed22c25b3d to your computer and use it in GitHub Desktop.

Select an option

Save bluedevilx/89fdf71e7354e03507da44ed22c25b3d to your computer and use it in GitHub Desktop.

Revisions

  1. @fungiboletus fungiboletus created this gist Oct 21, 2025.
    35 changes: 35 additions & 0 deletions zram-earlyoom.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    - name: Overprovision like the pros'
    hosts: all
    tasks:
    - name: Install early OOM killer and zram
    ansible.builtin.apt:
    pkg:
    - earlyoom
    - zram-tools
    - name: Configure early OOM killer
    ansible.builtin.lineinfile:
    path: /etc/default/earlyoom
    regexp: "^EARLYOOM_ARGS="
    line: 'EARLYOOM_ARGS="-r 15"'
    - name: Enable early OOM killer
    ansible.builtin.systemd:
    name: earlyoom
    state: restarted
    enabled: true
    daemon_reload: true
    - name: Configure zram algorithm
    ansible.builtin.lineinfile:
    path: /etc/default/zramswap
    regexp: "^ALGO="
    line: "ALGO=zstd"
    - name: Configure zram percent
    ansible.builtin.lineinfile:
    path: /etc/default/zramswap
    regexp: "^PERCENT="
    line: "PERCENT=25"
    - name: (Re)start zram service
    ansible.builtin.systemd:
    name: zramswap
    state: restarted
    enabled: true
    daemon_reload: true