Initial commit
This commit is contained in:
commit
6c799f6dbc
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
.*.swp
|
||||
*~
|
||||
|
35
README.md
Normal file
35
README.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# systemd-journald-size
|
||||
|
||||
Set maximum disk usage for systemd-journald
|
||||
|
||||
## Requirements
|
||||
|
||||
- systemd based Linux distribution with systemd-journald
|
||||
|
||||
## Role Variables
|
||||
|
||||
Defaults:
|
||||
- `systemd_journald_size`: `100M`
|
||||
|
||||
## Dependencies
|
||||
|
||||
- None
|
||||
|
||||
## Example Playbook
|
||||
|
||||
- hosts: all
|
||||
roles:
|
||||
- role: systemd-journald-size
|
||||
when: ansible_service_mgr == 'systemd'
|
||||
|
||||
|
||||
## License
|
||||
|
||||
AGPL3.0-or-later
|
||||
|
||||
## Author Information
|
||||
|
||||
- Sven Velt <sven-ansiblerole@velt.biz>
|
||||
- https://git.velt.biz/
|
||||
|
||||
|
3
defaults/main.yml
Normal file
3
defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
systemd_journald_size: 100M
|
||||
|
10
handlers/main.yml
Normal file
10
handlers/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- name: Restart systemd-journald
|
||||
service:
|
||||
name: systemd-journald
|
||||
state: restarted
|
||||
|
||||
- name: Vaccuum journald
|
||||
command:
|
||||
cmd: 'journalctl --vacuum-size={{ systemd_journald_size }}'
|
||||
|
39
meta/main.yml
Normal file
39
meta/main.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
galaxy_info:
|
||||
author: Sven Velt
|
||||
description: Set maximum disk usage of systemd-journald
|
||||
company: velt.biz
|
||||
issue_tracker_url: https://git.velt.biz/Ansible/systemd-journald-size/issues
|
||||
license: AGPL-3.0-or-later
|
||||
min_ansible_version: 2.1
|
||||
platforms:
|
||||
- name: Debian
|
||||
versions:
|
||||
- stretch
|
||||
- buster
|
||||
- bullseye
|
||||
- bookworm
|
||||
- trixie
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- bionic
|
||||
- focal
|
||||
- jammy
|
||||
- noble
|
||||
- name: Fedora
|
||||
versions:
|
||||
- 38
|
||||
- 39
|
||||
- 40
|
||||
- 41
|
||||
- name: EL
|
||||
versions:
|
||||
- 6
|
||||
- 7
|
||||
- 8
|
||||
- 9
|
||||
|
||||
galaxy_tags:
|
||||
- operations
|
||||
|
||||
dependencies: []
|
||||
|
7
systemd-journald-size.yml
Normal file
7
systemd-journald-size.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- hosts: all
|
||||
|
||||
roles:
|
||||
- role: systemd-journald-size
|
||||
when: ansible_service_mgr == 'systemd'
|
||||
|
30
tasks/main.yml
Normal file
30
tasks/main.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
- name: Check if systemd-journald is running
|
||||
service_facts:
|
||||
ignore_errors: true
|
||||
register: systemd_journald_services
|
||||
|
||||
- name: '[BLOCK] When systemd-journald is running...'
|
||||
when: systemd_journald_services is succeeded and "systemd-journald.service" in ansible_facts.services
|
||||
block:
|
||||
|
||||
- name: Create /etc/systemd/journald.conf.d
|
||||
file:
|
||||
path: /etc/systemd/journald.conf.d
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
- name: Template /etc/systemd/journald.conf.d/SystemMaxUse.conf
|
||||
template:
|
||||
src: SystemMaxUse.conf.j2
|
||||
dest: /etc/systemd/journald.conf.d/SystemMaxUse.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
backup: true
|
||||
notify:
|
||||
- Restart systemd-journald
|
||||
- Vaccuum journald
|
||||
|
2
templates/SystemMaxUse.conf.j2
Normal file
2
templates/SystemMaxUse.conf.j2
Normal file
|
@ -0,0 +1,2 @@
|
|||
[Journal]
|
||||
SystemMaxUse={{ systemd_journald_size }}
|
Loading…
Reference in a new issue