Skip to content

Commit

Permalink
feat: setup la roation des journaux systemd
Browse files Browse the repository at this point in the history
  • Loading branch information
Shamzic committed Oct 29, 2024
1 parent 55560e9 commit 5b5a6b2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions roles/bootstrap/handlers/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
ansible.builtin.service:
name: sshd
state: restarted
- name: restart systemd-journald

Check failure on line 11 in roles/bootstrap/handlers/main.yaml

View workflow job for this annotation

GitHub Actions / Lint ansible files

name[casing]

All names should start with an uppercase letter.
ansible.builtin.service:
name: systemd-journald
state: restarted
4 changes: 4 additions & 0 deletions roles/bootstrap/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
- name: Install and configure certbot
ansible.builtin.include_tasks: install_certbot.yaml

## Setup systemd
- name: Setup systemd journal rotation
ansible.builtin.include_tasks: setup_systemd_journal.yaml

## Setup Monitoring service
- name: Configure monitoring service
ansible.builtin.include_tasks: setup_monitor.yaml
Expand Down
15 changes: 15 additions & 0 deletions roles/bootstrap/tasks/setup_systemd_journal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Setup systemd journal rotation
ansible.builtin.blockinfile:
path: /etc/systemd/journald.conf
block: |
[Journal]
SystemMaxUse=2G
SystemMaxFileSize=100M
MaxRetentionSec=90d
Compress=yes
notify: restart systemd-journald

- name: Force immediate cleanup of old journals
ansible.builtin.command: journalctl --vacuum-time=90d
changed_when: true

0 comments on commit 5b5a6b2

Please sign in to comment.