Cap the systemd journal at 512M on disk, 128M in memory and two weeks in the common role

This commit is contained in:
2026-10-09 12:53:44 +00:00
parent fd73949412
commit b62992f21e
4 changed files with 31 additions and 0 deletions
+6
View File
@@ -6,3 +6,9 @@ disk_maintenance:
fstrim_on_calendar:
# Cron "minute hour" of the monthly ZFS trim and scrub from zfsutils-linux; unset keeps 00:24.
zfs_cron_time:
# journald.conf [Journal] settings of a drop-in, in this order; null leaves journald untouched.
journald_size_cap:
SystemMaxUse: 512M
RuntimeMaxUse: 128M
MaxRetentionSec: 2week
+5
View File
@@ -1,2 +1,7 @@
- name: reload_sysctl
command: sysctl --system
- name: restart_journald
systemd:
name: systemd-journald
state: restarted
+17
View File
@@ -0,0 +1,17 @@
- name: Cap the journal size
when: journald_size_cap | default(none) is not none
block:
- name: Create the journald drop-in directory
file:
path: /etc/systemd/journald.conf.d
state: directory
- name: Set the journal size cap
copy:
dest: /etc/systemd/journald.conf.d/10-size-cap.conf
content: |
[Journal]
{% for key, value in journald_size_cap.items() %}
{{ key }}={{ value }}
{% endfor %}
notify: restart_journald
+3
View File
@@ -11,3 +11,6 @@
- import_tasks: ./networking.yml
- import_tasks: ./disk_maintenance.yml
- import_tasks: ./journald.yml
tags: journald