summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-09-22 19:17:49 +0000
committerGerrit Code Review <review@openstack.org>2015-09-22 19:17:49 +0000
commitf0d478b4f9a64ade24ed3b1ee6123607268ea52e (patch)
treed0d776c6d6d490f1dc5e8bef898a3ac853e432fd
parent77cae247c916940f7e2287829c37b800d6d28bd7 (diff)
parent208feadbcdca61dd84fa48331344c3cdbe7ca52f (diff)
Merge "Add logrotate class to Apache"
-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}