Cap the systemd journal at 512M on disk, 128M in memory and two weeks in the common role
This commit is contained in:
@@ -6,3 +6,9 @@ disk_maintenance:
|
|||||||
fstrim_on_calendar:
|
fstrim_on_calendar:
|
||||||
# Cron "minute hour" of the monthly ZFS trim and scrub from zfsutils-linux; unset keeps 00:24.
|
# Cron "minute hour" of the monthly ZFS trim and scrub from zfsutils-linux; unset keeps 00:24.
|
||||||
zfs_cron_time:
|
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
|
||||||
|
|||||||
@@ -1,2 +1,7 @@
|
|||||||
- name: reload_sysctl
|
- name: reload_sysctl
|
||||||
command: sysctl --system
|
command: sysctl --system
|
||||||
|
|
||||||
|
- name: restart_journald
|
||||||
|
systemd:
|
||||||
|
name: systemd-journald
|
||||||
|
state: restarted
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -11,3 +11,6 @@
|
|||||||
- import_tasks: ./networking.yml
|
- import_tasks: ./networking.yml
|
||||||
|
|
||||||
- import_tasks: ./disk_maintenance.yml
|
- import_tasks: ./disk_maintenance.yml
|
||||||
|
|
||||||
|
- import_tasks: ./journald.yml
|
||||||
|
tags: journald
|
||||||
|
|||||||
Reference in New Issue
Block a user