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.
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment