chzerv.log2ram
Ansible Role: log2ram
This Ansible role installs and sets up log2ram on systems like Debian, Ubuntu, Archlinux, CentOS, and Fedora. It’s particularly useful for systems using an SD Card, such as Raspberry Pi.
For Debian-based systems, this role uses an unofficial repository created by the author. For other distributions, the installation is done manually.
Requirements
No special requirements.
Role Variables
Here are the available variables along with their default values. You can also check the defaults/main.yml
file for more details.
log2ram_enable_on_boot: true
This determines if log2ram should start automatically when the system boots.
log2ram_reboot_after_install: true
This decides whether to restart the system after installing log2ram. The author suggests rebooting the system post-install. Note: Ansible will wait for the system to come back before continuing with other tasks.
log2ram_state: install
The possible actions are:
install
to set up log2ram,remove
to uninstall log2ram, orupdate
to update log2ram.
log2ram_size: "40M"
This is the size of the ramdisk. If you get the error
/var/log.hdd/ doesn't exist. Can't sync.
, you need to increase this to a value greater than 40M.
log2ram_use_rsync: "true"
This setting allows the use of
rsync
instead ofcp
. The author claims thatrsync
performs better.
log2ram_mail: "false"
If set to
false
, error mailing will be turned off when there isn't enough RAM space.
log2ram_path_disk: "/var/log"
This specifies where the logs are stored.
log2ram_use_zl2r: "false"
This indicates whether to enable zram compatibility. Note: zram needs to be activated and configured beforehand for this to work.
log2ram_compression_algorithm: "lz4"
The compression method used for zram. For further details, refer to the project's README.
log2ram_log_disk_size: "100M"
The size of the uncompressed zram.
Dependencies
None.
Example Playbook
Here’s a simple example of how to use this role (with variable values passed as parameters):
- hosts: server
vars_files:
- vars/main.yml
roles:
- { role: chzerv.log2ram }
The vars/main.yml
file could look like this:
---
log2ram_enable_on_boot: true
log2ram_reboot_after_install: true
log2ram_size: "50M"
log2ram_use_rsync: "false"
log2ram_mail: "true"
log2ram_path_disk: "/var/log"
log2ram_use_zl2r: "false"
log2ram_compression_algorithm: "lz4"
License
MIT / BSD
Author Information
Xristos Zervakis
Install and configure log2ram on Linux systems.
ansible-galaxy install chzerv.log2ram