summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYolanda Robla <yolanda.robla-mota@hp.com>2015-07-28 17:05:16 +0200
committerYolanda Robla <yolanda.robla-mota@hp.com>2015-08-15 09:13:17 +0200
commit208feadbcdca61dd84fa48331344c3cdbe7ca52f (patch)
tree94da52ab1c016c7266777f5eda9a446e733c6f0d
parent6559655964f1b52e1868794808a52ffce26182dd (diff)
Add logrotate class to Apache
Adding this subclass to httpd configuration, to allow modules using this manifest to setup log rotation for apache on demand. Please note that apache is installing a logrotate file by default here, but naming that on same way will overwrite it, and allow our desired log rotation. Depends-On: I7451ecc550b50b85c55784ef598f6b45412117fc Change-Id: I3ef60fd9386795007e5b55264cc6e91fa0b67c68
Notes
Notes (review): Verified+2: Jenkins Code-Review+1: K Jonathan Harker <code@gentlydownthe.net> Code-Review+2: Spencer Krum <nibz@spencerkrum.com> Code-Review+2: Elizabeth K. Joseph <lyz@princessleia.com> Workflow+1: Elizabeth K. Joseph <lyz@princessleia.com> Code-Review+1: Craige McWhirter <craige@mcwhirter.com.au> Code-Review+1: Clint Adams <clint@gcfm.net> Code-Review+1: Bruno Tavares <btavare@thoughtworks.com> Submitted-by: Jenkins Submitted-at: Tue, 22 Sep 2015 19:17:49 +0000 Reviewed-on: https://review.openstack.org/206582 Project: openstack-infra/puppet-httpd Branch: refs/heads/master
-rw-r--r--manifests/logrotate.pp39
1 files changed, 39 insertions, 0 deletions
diff --git a/manifests/logrotate.pp b/manifests/logrotate.pp
new file mode 100644
index 0000000..c9bad6d
--- /dev/null
+++ b/manifests/logrotate.pp
@@ -0,0 +1,39 @@
1# == Class: httpd::logrotate
2#
3class httpd::logrotate (
4 $options = [
5 'daily',
6 'missingok',
7 'rotate 30',
8 'compress',
9 'delaycompress',
10 'notifempty',
11 'create 640 root adm',
12 ],
13 $prerotate = [
14 "if [ -d /etc/logrotate.d/${::httpd::params::apache_name}-prerotate ]; then \\",
15 " run-parts /etc/logrotate.d/${::httpd::params::apache_name}-prerotate; \\",
16 'fi; \\',
17 ],
18 $postrotate = [
19 "if service ${::httpd::params::apache_name} status > /dev/null ; then \\",
20 " service ${::httpd::params::apache_name} reload > /dev/null; \\",
21 'fi; \\',
22 ],
23 $firstaction = 'undef',
24 $lastaction = 'undef',
25) inherits httpd::params {
26 include ::logrotate
27
28 $apache_logdir = "/var/log/${::httpd::params::apache_name}"
29 $logrotate_name = $::httpd::params::apache_name
30
31 ::logrotate::file { $logrotate_name:
32 log => "${apache_logdir}/*.log",
33 options => $options,
34 prerotate => $prerotate,
35 postrotate => $postrotate,
36 firstaction => $firstaction,
37 lastaction => $lastaction,
38 }
39}