From 91a2b30dd703c827deebfb69f1b5561773beac00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 10 Aug 2016 22:10:25 +0200 Subject: [PATCH] Add logrotate --- .gitmodules | 3 ++ modules/base_configuration/manifests/init.pp | 33 ++++++++++++++++++++ modules/logrotate | 1 + 3 files changed, 37 insertions(+) create mode 160000 modules/logrotate diff --git a/.gitmodules b/.gitmodules index 5310ea7..22459fc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,6 @@ [submodule "modules/fail2ban"] path = modules/fail2ban url = git://git.immae.eu/github/lelutin/puppet-fail2ban +[submodule "modules/logrotate"] + path = modules/logrotate + url = git://git.immae.eu/github/yo61/puppet-logrotate.git diff --git a/modules/base_configuration/manifests/init.pp b/modules/base_configuration/manifests/init.pp index f432e29..2b20a0e 100644 --- a/modules/base_configuration/manifests/init.pp +++ b/modules/base_configuration/manifests/init.pp @@ -59,6 +59,39 @@ class base_configuration ( include => '/etc/pacman.d/mirrorlist' } + class { '::logrotate': + manage_cron_daily => false, + config => { + rotate_every => 'week', + rotate => 4, + create => true, + compress => true, + olddir => '/var/log/old', + tabooext => "+ .pacorig .pacnew .pacsave", + } + } + + logrotate::rule { 'wtmp': + path => '/var/log/wtmp', + rotate_every => 'month', + create => true, + create_mode => '0664', + create_owner => 'root', + create_group => 'utmp', + rotate => '1', + minsize => '1M', + } + logrotate::rule { 'btmp': + path => '/var/log/btmp', + missingok => true, + rotate_every => 'month', + create => true, + create_mode => '0600', + create_owner => 'root', + create_group => 'utmp', + rotate => '1', + } + ensure_packages(["whois"], { 'install_options' => '--asdeps' }) class { 'fail2ban': logtarget => 'SYSLOG', diff --git a/modules/logrotate b/modules/logrotate new file mode 160000 index 0000000..ad87cf8 --- /dev/null +++ b/modules/logrotate @@ -0,0 +1 @@ +Subproject commit ad87cf8b589d60bdbd1bb6e9059a5bf742235ec3 -- 2.41.0