From 4395180ec67b7254c30cce06f1a1152730240863 Mon Sep 17 00:00:00 2001 From: ITQ Date: Tue, 19 May 2026 09:31:57 +0300 Subject: [PATCH] feat(cron): added atop logs cleanup cron --- group_vars/all/all.yaml | 1 + roles/common/tasks/cron.yaml | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/group_vars/all/all.yaml b/group_vars/all/all.yaml index 80d5b03..c736347 100644 --- a/group_vars/all/all.yaml +++ b/group_vars/all/all.yaml @@ -13,6 +13,7 @@ monitoring_enabled: true # Logs common_journal_retention_days: 21 common_journal_max_disk_limit: "5%" +common_atop_retention_days: 3 # User management admin_users: diff --git a/roles/common/tasks/cron.yaml b/roles/common/tasks/cron.yaml index e390ec3..628d5e5 100644 --- a/roles/common/tasks/cron.yaml +++ b/roles/common/tasks/cron.yaml @@ -8,3 +8,13 @@ job: "/usr/bin/journalctl --vacuum-time={{ common_journal_retention_days }}d --vacuum-size={{ common_journal_max_disk_limit }} > /dev/null 2>&1" user: root state: present + +- name: Create cron job to prune atop with configurable limits + become: true + ansible.builtin.cron: + name: "Prune atop logs ({{ common_atop_retention_days }} days" + minute: "0" + hour: "2" + job: "/usr/bin/find /var/log/atop -name 'atop_*' -mtime +{{ common_atop_retention_days }} -delete > /dev/null 2>&1" + user: root + state: present