Skip to content

Commit

Permalink
Allow declaration of cron class without managing the cron package
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-mueller committed Feb 27, 2016
1 parent 8b080cd commit 1a11b09
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,27 @@ Keep that in mind when choosing the name to avoid overwriting existing system cr

### cron

This module can optionally install the cron package if needed.
Most systems ship with cron already installed, doing this is usually not required. But you can use it via:
If you want the class to automatically install the correct cron package you can declare the `cron` class. By default it will then install the right package.
If you want to use Hiera to configure your cronjobs, you must declare the `cron` class.

include cron
You can disable the managment of the cron package by setting the `manage_package` parameter to `false`.

or:
This class allows specifiying the following parameter:

class { 'cron': }
* `manage_package` - optional - defaults to "true"
* `package_ensure` - optional - defaults to "installed"

It allows specifiying the following parameter:

* `package_ensure` - optional - defaults to "installed"
Examples:

include cron

or:

class { 'cron':
manage_package => false,
}


### cron::job

Expand Down
25 changes: 19 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
# Class: cron
#
# This class wraps *cron::instalL* for ease of use
# This class wraps *cron::install* for ease of use
#
# Parameters:
# package_ensure - Can be set to a package version, 'latest', 'installed' or 'present'.
# manage_package - Can be set to disable package installation.
# Set to true to manage it, false to not manage it.
# Default: true
#
# package_ensure - Can be set to a package version, 'latest', 'installed' or
# 'present'.
# Default: installed
#
#
# Actions:
#
# Requires:
#
# Sample Usage:
# include 'cron'
# class { 'cron': }
# or:
# class { 'cron':
# manage_package => false,
# }
#
class cron (
$package_ensure = 'installed'
$manage_package = true,
$package_ensure = 'installed',
) {

class { '::cron::install':
package_ensure => $package_ensure,
if $manage_package {
class { '::cron::install':
package_ensure => $package_ensure,
}
}

# Create jobs from hiera
Expand Down
4 changes: 2 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# Sample Usage:
# This class should not be used directly under normal circumstances
# Instead, use the *cron* class.

#
class cron::install (
$package_ensure = 'installed'
$package_ensure = 'installed',
) {

$package_name = $::operatingsystem ? {
Expand Down

0 comments on commit 1a11b09

Please sign in to comment.