From 579032189f2fba71aa039fbf10cec4d9483dc481 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sat, 28 Mar 2020 16:34:52 -0500 Subject: [PATCH] Make days retained configurable --- README.md | 4 +++- defaults/main.yml | 3 ++- templates/Fedora/29/etc/logrotate.conf | 2 +- templates/Fedora/30/etc/logrotate.conf | 2 +- templates/Fedora/31/etc/logrotate.conf | 2 +- templates/RedHat/6/etc/logrotate.conf | 2 +- templates/RedHat/7/etc/logrotate.conf | 2 +- templates/RedHat/8/etc/logrotate.conf | 2 +- 8 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dd0bb55..d9c56aa 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ Any pre-requisites that may not be covered by Ansible itself or the role should Role Variables -------------- -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. +| variable | default | purpose | +| - | - | - | +| log_retention_days | 90 | Number of days to retain logs on the system | Dependencies ------------ diff --git a/defaults/main.yml b/defaults/main.yml index c78583b..d8f2210 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,3 @@ --- -# defaults file for ensure_log_rotation \ No newline at end of file +# defaults file for ensure_log_rotation +log_retention_days: '90' diff --git a/templates/Fedora/29/etc/logrotate.conf b/templates/Fedora/29/etc/logrotate.conf index 54b6e97..8cba9ae 100644 --- a/templates/Fedora/29/etc/logrotate.conf +++ b/templates/Fedora/29/etc/logrotate.conf @@ -3,7 +3,7 @@ daily # keep 4 weeks worth of backlogs -rotate 90 +rotate {{ log_retention_days }} # create new (empty) log files after rotating old ones create diff --git a/templates/Fedora/30/etc/logrotate.conf b/templates/Fedora/30/etc/logrotate.conf index 54b6e97..8cba9ae 100644 --- a/templates/Fedora/30/etc/logrotate.conf +++ b/templates/Fedora/30/etc/logrotate.conf @@ -3,7 +3,7 @@ daily # keep 4 weeks worth of backlogs -rotate 90 +rotate {{ log_retention_days }} # create new (empty) log files after rotating old ones create diff --git a/templates/Fedora/31/etc/logrotate.conf b/templates/Fedora/31/etc/logrotate.conf index 54b6e97..8cba9ae 100644 --- a/templates/Fedora/31/etc/logrotate.conf +++ b/templates/Fedora/31/etc/logrotate.conf @@ -3,7 +3,7 @@ daily # keep 4 weeks worth of backlogs -rotate 90 +rotate {{ log_retention_days }} # create new (empty) log files after rotating old ones create diff --git a/templates/RedHat/6/etc/logrotate.conf b/templates/RedHat/6/etc/logrotate.conf index 54b6e97..8cba9ae 100644 --- a/templates/RedHat/6/etc/logrotate.conf +++ b/templates/RedHat/6/etc/logrotate.conf @@ -3,7 +3,7 @@ daily # keep 4 weeks worth of backlogs -rotate 90 +rotate {{ log_retention_days }} # create new (empty) log files after rotating old ones create diff --git a/templates/RedHat/7/etc/logrotate.conf b/templates/RedHat/7/etc/logrotate.conf index 54b6e97..8cba9ae 100644 --- a/templates/RedHat/7/etc/logrotate.conf +++ b/templates/RedHat/7/etc/logrotate.conf @@ -3,7 +3,7 @@ daily # keep 4 weeks worth of backlogs -rotate 90 +rotate {{ log_retention_days }} # create new (empty) log files after rotating old ones create diff --git a/templates/RedHat/8/etc/logrotate.conf b/templates/RedHat/8/etc/logrotate.conf index 54b6e97..8cba9ae 100644 --- a/templates/RedHat/8/etc/logrotate.conf +++ b/templates/RedHat/8/etc/logrotate.conf @@ -3,7 +3,7 @@ daily # keep 4 weeks worth of backlogs -rotate 90 +rotate {{ log_retention_days }} # create new (empty) log files after rotating old ones create