From d68d29e0eb54cc32a64c27923681880076922f73 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Mon, 17 Feb 2020 12:25:23 +0100 Subject: [PATCH] common: set journald and logratete.conf rentention to 7 days --- roles/common/tasks/main.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 5a4765b..34082db 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -27,6 +27,7 @@ - name: Configure misc software copy: src={{ item.src }} dest={{ item.dest }} + diff: no with_items: - { src: '.zshrc', dest: '/root/.zshrc' } - { src: '.zshrc.local', dest: '/root/.zshrc.local' } @@ -52,3 +53,23 @@ path: /etc/pam.d/su regexp: '^.*auth\s+required\s+pam_wheel.so$' line: 'auth required pam_wheel.so' + +- name: Configure journald retention + lineinfile: + path: "/etc/systemd/journald.conf" + state: "present" + regexp: "^#?MaxRetentionSec=.*" + line: "MaxRetentionSec=7day" + notify: Restart journald + +- name: Set logrotate.conf to daily + replace: + path: "/etc/logrotate.conf" + regexp: "(?:weekly|monthly)" + replace: "daily" + +- name: Set logrotate.conf rotation to 7 + replace: + path: "/etc/logrotate.conf" + regexp: "rotate [0-9]+" + replace: "rotate 7"