This role installs and configures log2ram on Debian, Ubuntu, ArchLinux, CentOS and Fedora systems. log2ram is mostly useful on systems which use an SD Card, like for example a Raspberry-Pi.
On Debian-based systems, the role uses the author's unofficial repository. On other distributions the installation is done manually.
Below is a list of the available variables and their default values. Make sure to also check the defaults/main.yml file.
log2ram_enable_on_boot: trueWhether to enable log2ram on boot or not.
log2ram_reboot_after_install: trueWhether to reboot the machine after instralling
log2ramor not. The project's author recommends to reboot the machine after installing log2ram. Note that Ansible will wait for the systems to come back up and continue with the rest of the tasks.
log2ram_state: installPossible values are:
installto install log2ram,removeto uninstall log2ram andupdateto update log2ram.
log2ram_size: "40M"The ramdisk size. In case of the error
/var/log.hdd/ doesn't exist.Can't sync., the size has to be increased to a value > 40M!
log2ram_use_rsync: "true"Whether to use
rsyncinstead ofcp. According tolog2ram's author,rsyncoffers better performance.
log2ram_mail: "false"If set to
false, the error system mail will be disabled if there's not enough space in RAM.
log2ram_path_disk: "/var/log"Where the logs are saved.
log2ram_use_zl2r: "false"Whether to enable
zramcompatibility. Note that zram must be already enabled and configured on the device if you want to use this.
log2ram_compression_algorithm: "lz4"The compression algorithm used for zram. Check the project's README for more information.
log2ram_log_disk_size: "100M"The uncompressed zram size.
None.
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: server
vars_files:
- vars/main.yml
roles:
- { role: chzerv.log2ram }The vars/main.yml file:
---
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"