arillso.system.zram role – Configure compressed RAM swap (zram) on Linux systems

Note

This role is part of the arillso.system collection (version 1.1.6).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it use: ansible-galaxy collection install arillso.system.

To use it in a playbook, specify: arillso.system.zram.

Entry point main – Configure compressed RAM swap (zram) on Linux systems

Synopsis

  • Installs the zram-tools package and the kernel module that provides zram

  • Validates the requested compression algorithm against kernel capabilities

  • Deploys /etc/default/zramswap and enables the zramswap service

  • arillso

Parameters

Parameter

Comments

zram_algorithm

string

Kernel compression algorithm for the zram device

Validated at runtime against /sys/block/zram0/comp_algorithm

Default: "zstd"

zram_enabled

boolean

Enable or disable the zram role; false makes every task a no-op

Choices:

  • false

  • true ← (default)

zram_kernel_module_package

string

Package that provides the zram kernel module; empty value skips the install

On Ubuntu, resolved at runtime to linux-modules-extra-<kernel> so kernel upgrades pull the matching package

Empty on Debian, which ships the zram module in the stock kernel with no separate package

zram_packages

list / elements=string

Distribution packages to install that provide zram userspace tooling

Default: ["zram-tools"]

zram_percent

integer

Percentage of physical RAM to allocate as the zram swap device

50 means a 16 GB host gets an 8 GB zram device

Default: 50

zram_priority

integer

Linux swap priority for the zram device (higher wins)

Should be greater than any disk-based swap priority so the kernel fills zram first

Default: 100