Merge "Move anacron module functionality to openstack::logrotate"

This commit is contained in:
Jenkins 2015-06-18 13:46:34 +00:00 committed by Gerrit Code Review
commit 6b5a4d67a6
11 changed files with 10 additions and 173 deletions

View File

@ -1,5 +0,0 @@
= anacron
This module configures anacron to run jobs in the *idle* i/o class.
(source ttp://code.seas.harvard.edu/puppet/puppet/trees/master/modules/anacron)

View File

@ -1,21 +0,0 @@
#!/bin/bash
# managed by puppet
#
#!!! do not perform day checks here, cuz it would prevent hourly jobs from execution !!!
#in case file doesn't exist
#if test -r /var/spool/anacron/cron.daily; then
# day=`cat /var/spool/anacron/cron.daily`
#fi
#if [ `date +%Y%m%d` = "$day" ]; then
# exit 0;
#fi
#
# in case anacron is already running,
# there will be log (daemon won't be running twice).
if [[ -x /usr/bin/on_ac_power ]]; then
/usr/bin/on_ac_power &> /dev/null
if [[ $? -eq 1 ]]; then
exit 0
fi
fi
/usr/sbin/anacron -s

View File

@ -1,14 +0,0 @@
#!/bin/sh
# managed by puppet
#
# anacron's cron script
#
# This script updates anacron time stamps. It is called through run-parts
# either by anacron itself or by cron.
#
# The script is called "0anacron" to assure that it will be executed
# _before_ all other scripts.
# Uncomment these lines below, if anacron should manage hourly schedules (by default, it does not)
#test -x /usr/sbin/anacron || exit 0
#anacron -u cron.hourly

View File

@ -1,6 +0,0 @@
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
01 * * * * root nice ionice -c3 run-parts /etc/cron.hourly

View File

@ -1,7 +0,0 @@
# /etc/cron.d/anacron: crontab entries for the anacron package
# managed by puppet
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
30 7 * * * root start -q anacron || :

View File

@ -1,16 +0,0 @@
# /etc/anacrontab: configuration file for anacron
# managed by puppet
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=25
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice ionice -c3 run-parts /etc/cron.daily
7 25 cron.weekly nice ionice -c3 run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice ionice -c3 run-parts /etc/cron.monthly

View File

@ -1,18 +0,0 @@
# /etc/anacrontab: configuration file for anacron
# managed by puppet
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=25
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
# These, except hourly, replace cron's entries
#period in days delay in minutes job-identifier command
1 5 cron.daily nice ionice -c3 run-parts /etc/cron.daily
7 25 cron.weekly nice ionice -c3 run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice ionice -c3 run-parts /etc/cron.monthly

View File

@ -1,5 +0,0 @@
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
*/10 * * * * root nice ionice -c3 /usr/bin/fuel-logrotate

View File

@ -1,64 +0,0 @@
# Make periodic cron jobs run in the idle scheduling class to reduce
# their impact on other system activities.
# Make anacron being manage 20-fuel logrotate job in /etc/cron.hourly
# for RHEL/CENTOS, and same by cron (it does by default) for DEBIAN/UBUNTU
class anacron::config {
File {
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
}
case $::osfamily {
'RedHat': {
# assume cronie-anacron is installed
file { '/etc/anacrontab':
source => 'puppet:///modules/anacron/anacrontab',
}
file { '/etc/cron.hourly/':
ensure => directory,
mode => '0755',
owner => 'root',
}
file { '/etc/cron.d/':
ensure => directory,
mode => '0755',
owner => 'root',
}
file { '/etc/cron.d/0hourly':
source => 'puppet:///modules/anacron/0hourly',
}
file { '/etc/cron.hourly/0anacron':
mode => '0755',
source => 'puppet:///modules/anacron/0anacron-hourly',
}
}
'Debian': {
# assume anacron is installed
file { '/etc/anacrontab':
source => 'puppet:///modules/anacron/anacrontab-ubuntu',
}
file { '/etc/cron.d/anacron':
source => 'puppet:///modules/anacron/anacron-ubuntu',
}
}
default: {
fail("Unsupported platform: ${::osfamily}/${::operatingsystem}")
}
}
if $::anacron::debug {
file { '/etc/cron.d/logrotate-debug':
source => 'puppet:///modules/anacron/logrotate-debug'
}
}
}

View File

@ -1,9 +0,0 @@
# anacron
#
# Changes to crontabs managed by anacron.
class anacron (
$debug = false,
) {
include anacron::config
}

View File

@ -28,17 +28,13 @@ class openstack::logrotate (
}
}
# Configure (ana)cron for fuel custom hourly logrotations
class { '::anacron':
debug => $debug,
}
# TODO(aschultz): should move these to augeas when augeas is upgraded to
# >=1.4.0 because maxsize isn't supported until 1.4.0 which breaks everything.
File_line {
ensure => 'present',
path => '/etc/logrotate.conf',
}
# We're using after here to place these options above the include
# /etc/logrotate.d as file_line does not have a before option.
file_line { 'logrotate-tabooext':
@ -62,14 +58,20 @@ class openstack::logrotate (
after => '^delaycompress',
} ->
file_line { 'logrotate-maxsize':
line => "maxsize ${maxsize}",
match => '^maxsize',
line => "maxsize ${maxsize}",
match => '^maxsize',
after => '^minsize',
}
if $debug {
$interval = '10'
} else {
$interval = '30'
}
cron { 'fuel-logrotate':
command => '/usr/bin/fuel-logrotate',
user => 'root',
minute => '*/30',
minute => "*/${interval}",
}
}