Code Monkey home page Code Monkey logo

puppet-module-cron's Introduction

puppet-module-cron

Manage the cron configuration files.

  • /etc/crontab
  • /etc/cron.allow
  • /etc/cron.deny
  • /etc/cron.d/
  • /etc/cron.hourly
  • /etc/cron.daily
  • /etc/cron.weekly
  • /etc/cron.monthly
  • /etc/cron.yearly

===

Compatibility

This module has been tested to work on the following systems with Puppet v3 (with and without the future parser) and Puppet v4 with Ruby versions 1.8.7, 1.9.3, 2.0.0 and 2.1.0.

  • EL 5
  • EL 6
  • SLES 10
  • SLES 11
  • SLES 12
  • Ubuntu 12

Note that SLES patches ISC's cron such that if cron.allow and cron.deny are both missing, then root will not be able to access the crontabs. This will cause errors. Please see the Hiera example below.

===

Class cron

Parameters

A value of 'undef' will use the defaults specified by the module.

package_ensure (string)

String for the ensure parameter for the cron package. Valid values are 'installed', 'present' and 'absent'.

  • Default: 'installed'

package_name (string or array)

Name of the cron package(s). Specify this to change the platform's default.

  • Default: 'USE_DEFAULTS'

crontab_path (string)

String for path to system wide crontab.

  • Default: '/etc/crontab'

crontab_owner (string)

Name of the owner of the crontab file.

  • Default: 'root'

crontab_group (string)

Name of the group of the crontab file.

  • Default: 'root'

crontab_mode (string)

Filemode of the crontab file. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/

  • Default: '0644'

cron_allow (string)

If the file cron.allow exists, only users listed in it are allowed to use cron, and the cron.deny file is ignored. Valid values are 'present' and 'absent'.

  • Default: 'absent'

cron_deny (string)

If cron.allow does not exist, users listed in cron.deny are not allowed to use cron. Valid values are 'present' and 'absent'.

  • Default: 'present'

cron_allow_path (string)

Path to cron.allow.

  • Default: '/etc/cron.allow'

cron_allow_owner (string)

Name of the owner of the cron_allow file.

  • Default: 'root'

cron_allow_group (string)

Name of the group of the cron_allow file.

  • Default: 'root'

cron_allow_mode (string)

Filemode of the cron_allow file. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/

  • Default: '0644'

cron_deny_path (string)

Path to cron.deny.

  • Default: '/etc/cron.deny'

cron_deny_owner (string)

Name of the owner of the cron_deny file.

  • Default: 'root'

cron_deny_group (string)

Name of the group of the cron_deny file.

  • Default: 'root'

cron_deny_mode (string)

Filemode of the cron_deny file. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/

  • Default: '0644'

cron_d_path (string)

Path to cron.d directory. Must be an absolute path.

  • Default: '/etc/cron.d'

cron_hourly_path (string)

Path to cron.d directory. Must be an absolute path.

  • Default: '/etc/cron.hourly'

cron_daily_path (string)

Path to cron.daily directory. Must be an absolute path.

  • Default: '/etc/cron.daily'

cron_weekly_path (string)

Path to cron.weekly directory. Must be an absolute path.

  • Default: '/etc/cron.weekly'

cron_monthly_path (string)

Path to cron.monthly directory. Must be an absolute path.

  • Default: '/etc/cron.monthly'

cron_dir_owner (string)

Name of the owner of the cron directories cron.d, cron.hourly, cron.daily, cron.weekly and cron.monthly.

  • Default: 'root'

cron_dir_group (string)

Name of the group of the cron.d directories cron.d, cron.hourly, cron.daily, cron.weekly and cron.monthly.

  • Default: 'root'

cron_dir_mode (string)

Filemode of the cron.d directories cron.d, cron.hourly, cron.daily, cron.weekly and cron.monthly. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/

  • Default: '0755'

cron_files (hash)

Hash of files managed in cron.hourly, cron.daily, cron.weekly, cron.monthly and cron.yearly. See define cron::fragment for hash structure and examples for examples.

  • Default: undef

cron_allow_users (array)

Array of all users to be included in cron.allow.

  • Default: undef

cron_deny_users (array)

Array of all users to be included in cron.deny.

  • Default: undef

crontab_vars (hash)

Hash that defines the crontab variables SHELL, PATH, MAILTO, HOME. if this variable is undef the module will use the values defined in crontab template which are SHELL=/bin/bash, PATH=/sbin:/bin:/usr/sbin:/usr/bin, MAILTO=root, HOME=/

  • Default: undef

crontab_tasks (hash)

Hash for crontab tasks.

  • Default: undef

service_enable (bool)

Boolean to enable the cron service.

  • Default: true

service_ensure (string)

String for the ensure parameter for the cron service. Valid values are 'running' and 'stopped'.

  • Default: 'running'

service_name (string)

Name of the cron service. Specify this to change the platform's default.

  • Default: 'USE_DEFAULTS'

Sample usage:

Work on Suse

cron::cron_allow: 'present'
cron::cron_allow_users:
  - root

Define crontab variables

cron::crontab_vars:
  SHELL: /bin/bash
  PATH: /sbin:/bin:/usr/sbin:/usr/bin
  MAILTO: root
  HOME: /root

Create /etc/cron.daily/daily_task

cron::cron_files:
     'daily_task':
       ensure: 'present'
       type: 'daily'
       content: |
            #!/bin/bash
            # This File is managed by puppet
            command

Manage /etc/cron.allow

cron::cron_allow: 'present'
cron::cron_allow_users:
     - user1

Manage /etc/cron.deny

cron::cron_deny: 'present'
cron::cron_deny_users:
     - user1

Manage /etc/crontab

cron::crontab_tasks:
   'task1':
    - "* 12 * * 7 username echo 'Hello World'"
    - "2 2 * * 6 username echo 'tes'"
   'task2':
    - "* 6 * * 7 root echo 'test'"

Define cron::fragment

Parameters

ensure (string)

String for the ensure parameter of the cron fragment file. Valid values are 'absent', 'file' and 'present'.

  • Default: 'absent'

content (string)

String to represent contents of cron job.

  • Default: ''

owner (string)

Name of the owner of the fragment file.

  • Default: 'root'

group (string)

Name of the group of the fragment file.

  • Default: 'root'

mode (string)

Filemode of the fragment file. Must use the four-digit octal notation. RegEx: /^[0-7]{4}$/ By default it will depend on the used type parameter (see below). If type is set to 'd' it will set mode to '0644', in all other cases it will set mode to '0755'.

  • Default: 'USE_DEFAULTS'

type (string)

The type of cron job. This generally refers to "/etc/cron.${type}/". Valid values are 'd', 'hourly, 'daily', 'weekly', 'monthly' and 'yearly'.

  • Default: 'daily'

puppet-module-cron's People

Contributors

phil-friderici avatar ghoneycutt avatar anders-larsson avatar abentoumi avatar

Watchers

James Cloos avatar Robert Hallgren avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.