- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with puppet-cron
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
This is yet another puppet-cron module. It will set up cron (by installed the package and making sure the service is running) and also includes a defined type which will put cron jobs in /etc/cron.d
The cron::job
type can:
- Set up locking, using
flock
, meaning cronjobs don't clobber each other - If you use sensu, alert when they fail, using sensu-wrapper
This module has some similarities to Yelp's puppet-cron with the intention of being much simpler while still providing some of the cool stuff in that module
- puppet-cron will ensure the cronie or cron package is installed
- It will may modify the permissions of several cron directories, like
/etc/crond.d
Simply include the cron module like so:
include ::cron
You may want to use a class include if you wish to override parameters:
class { '::cron' :
crond_dir => '/etc/cron'
}
include ::cron
Use the cron::job
defined type:
::cron::job {
minute => '02',
hour => '1',
lock => true
}
This will create a cronjob file in $crond_dir
(default: /etc/cron.d
) which will run on the schedule you specified.
cron
: Installs and configures cron in your environment.cron::job
: Installs and configures a cronjob in$crond_dir
- [
cron::install
]: Installs the required cron package - [
cron::configure
]: Configures cron's required directories - [
cron::service
]: Manages the cron service
Specifies the package to install for cron
Specifies the version of the cron package to install (default: os dependent)
Specifies the cron service to manage (default: latest)
Specifies the state of the cron service (running, stopped - default: running)
Specifies whether the crond service should be enabled on startup (true, false - default: true)
Specifies the path to the OS crontab file (default: os dependent)
Specifies the path to the cron.d dir (default: /etc/cron.d
)
Specifies the path to the cron.hourly scripts directory (default: /etc/cron.hourly
)
Specifies the path to the cron.weekly scripts directory (default: /etc/cron.weekly
)
Specifies the path to the cron.monthly scripts directory (default: /etc/cron.monthly
)
Specifies the user to own the crond dirs and files (default: 'root' - CHANGE WITH CAUTION)
Specifies the group to own the crond dirs and files (default: 'root' - CHANGE WITH CAUTION)
Specifies whether to purge the $crond_dir directory of jobs not specified by puppet (default: false)
Specifies the command to run in the job (required)
Specifies whether the job should exist or not (default: present)
Specifies the cron style minute the job should run (default: '*')
Specifies the cron style hour the should run (default: '*')
Specifies the cron style day of the month the job should run (default: '*')
Specifies the cron style montht the job should run (default: '*')
Specifies the cron style day of the week the job should run (default: '*')
Specifies the user the cron job should run as (default: 'root')
Specifies an array of environment variables for the job in fhe format ENV=value
(default: [])
Specifies whether the cron job should lock itself using flock
(default: false)
Specifies whether you want to monitor the job using sensu-wrapper (default: undef)
Specifies a TTL for the job for sensu-wrapper (default: undef)
Specifies a source string for the alert generated in sensu (default: undef)
Specifies a timeout for sensu-wrapper before the job should halt and fail (default: undef)
Specifies additional json to include in the sensu-wrapper output (default: undef)
Specifies a handler for sensu-wrapper to use when creating event (default: undef)