{"id":27958040,"url":"https://github.com/ericsson/puppet-module-cron","last_synced_at":"2025-05-07T18:15:59.443Z","repository":{"id":13269528,"uuid":"15954944","full_name":"Ericsson/puppet-module-cron","owner":"Ericsson","description":"Puppet module to manage cron","archived":false,"fork":false,"pushed_at":"2018-10-25T05:30:46.000Z","size":120,"stargazers_count":4,"open_issues_count":1,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-07T18:15:54.687Z","etag":null,"topics":["puppet"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ericsson.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-16T01:51:54.000Z","updated_at":"2019-03-05T11:14:28.000Z","dependencies_parsed_at":"2022-08-25T17:41:12.545Z","dependency_job_id":null,"html_url":"https://github.com/Ericsson/puppet-module-cron","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ericsson%2Fpuppet-module-cron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ericsson%2Fpuppet-module-cron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ericsson%2Fpuppet-module-cron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ericsson%2Fpuppet-module-cron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ericsson","download_url":"https://codeload.github.com/Ericsson/puppet-module-cron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252931507,"owners_count":21827112,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["puppet"],"created_at":"2025-05-07T18:15:58.543Z","updated_at":"2025-05-07T18:15:59.368Z","avatar_url":"https://github.com/Ericsson.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# puppet-module-cron\n\nManage the cron configuration files.\n\n- /etc/crontab\n- /etc/cron.allow\n- /etc/cron.deny\n- /etc/cron.d/\n- /etc/cron.hourly\n- /etc/cron.daily\n- /etc/cron.weekly\n- /etc/cron.monthly\n- /etc/cron.yearly\n\n\n===\n\n# Compatibility\n\nThis module has been tested to work on the following systems with Puppet v3\n(with and without the future parser) and Puppet v4 with Ruby versions 1.8.7,\n1.9.3, 2.0.0, 2.1.0 and 2.3.1.\n\n * EL 5\n * EL 6\n * SLES 10\n * SLES 11\n * SLES 12\n * Ubuntu 12\n\nNote that SLES patches ISC's cron such that if cron.allow and cron.deny are\nboth missing, then root will not be able to access the crontabs. This will\ncause errors. Please see the Hiera example below.\n\n===\n\n## Class `cron`\n\n### Parameters\nA value of `'undef'` will use the defaults specified by the module.\n\n\npackage_ensure (string)\n-----------------------\nString for the ensure parameter for the cron package. Valid values are 'installed', 'present' and 'absent'.\n\n- *Default*: 'installed'\n\npackage_name (string or array)\n------------------------------\nName of the cron package(s). Specify this to change the platform's default.\n\n- *Default*: 'USE_DEFAULTS'\n\ncrontab_path (string)\n---------------------\nString for path to system wide crontab.\n\n- *Default*: '/etc/crontab'\n\ncrontab_owner (string)\n----------------------\nName of the owner of the crontab file.\n\n- *Default*: 'root'\n\ncrontab_group (string)\n----------------------\nName of the group of the crontab file.\n\n- *Default*: 'root'\n\ncrontab_mode (string)\n---------------------\nFilemode of the crontab file. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/\n\n- *Default*: '0644'\n\ncron_allow (string)\n-------------------\nIf the file cron.allow exists, only users listed in it are allowed to use cron,\nand the cron.deny file is ignored. Valid values are 'present' and 'absent'.\n\n- *Default*: 'absent'\n\ncron_deny (string)\n------------------\nIf cron.allow does not exist, users listed in cron.deny are not allowed to use\ncron. Valid values are 'present' and 'absent'.\n\n- *Default*: 'present'\n\ncron_allow_path (string)\n------------------------\nPath to cron.allow.\n\n- *Default*: '/etc/cron.allow'\n\ncron_allow_owner (string)\n-------------------------\nName of the owner of the cron_allow file.\n\n- *Default*: 'root'\n\ncron_allow_group (string)\n-------------------------\nName of the group of the cron_allow file.\n\n- *Default*: 'root'\n\ncron_allow_mode (string)\n------------------------\nFilemode of the cron_allow file. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/\n\n- *Default*: '0644'\n\ncron_deny_path (string)\n-----------------------\nPath to cron.deny.\n\n- *Default*: '/etc/cron.deny'\n\ncron_deny_owner (string)\n------------------------\nName of the owner of the cron_deny file.\n\n- *Default*: 'root'\n\ncron_deny_group (string)\n------------------------\nName of the group of the cron_deny file.\n\n- *Default*: 'root'\n\ncron_deny_mode (string)\n-----------------------\nFilemode of the cron_deny file. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/\n\n- *Default*: '0644'\n\ncron_d_path (string)\n--------------------\nPath to cron.d directory. Must be an absolute path.\n\n- *Default*: '/etc/cron.d'\n\ncron_hourly_path (string)\n-------------------------\nPath to cron.d directory. Must be an absolute path.\n\n- *Default*: '/etc/cron.hourly'\n\ncron_daily_path (string)\n------------------------\nPath to cron.daily directory. Must be an absolute path.\n\n- *Default*: '/etc/cron.daily'\n\ncron_weekly_path (string)\n-------------------------\nPath to cron.weekly directory. Must be an absolute path.\n\n- *Default*: '/etc/cron.weekly'\n\ncron_monthly_path (string)\n--------------------------\nPath to cron.monthly directory. Must be an absolute path.\n\n- *Default*: '/etc/cron.monthly'\n\ncron_dir_owner (string)\n-----------------------\nName of the owner of the cron directories cron.d, cron.hourly, cron.daily, cron.weekly and cron.monthly.\n\n- *Default*: 'root'\n\ncron_dir_group (string)\n-----------------------\nName of the group of the cron.d directories cron.d, cron.hourly, cron.daily, cron.weekly and cron.monthly.\n\n- *Default*: 'root'\n\ncron_dir_mode (string)\n----------------------\nFilemode 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]$/\n\n- *Default*: '0755'\n\ncron_files (hash)\n-----------------\nHash of files managed in cron.hourly, cron.daily, cron.weekly, cron.monthly and cron.yearly.\nSee define cron::fragment for hash structure and examples for examples.\n\n- *Default*: undef\n\ncron_allow_users (array)\n------------------------\nArray of all users to be included in cron.allow.\n\n- *Default*: undef\n\ncron_deny_users (array)\n-----------------------\nArray of all users to be included in cron.deny.\n\n- *Default*: undef\n\ncrontab_vars (hash)\n-------------------\nHash 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=/\n\n- *Default*: undef\n\ncrontab_tasks (hash)\n--------------------\nHash for crontab tasks.\n\n- *Default*: undef\n\nperiodic_jobs_content (array or string)\n---------------------------------------\nLog entry lines for the periodic jobs section. One entry per line. Leave it unset (undef) to use the OS vendor defaults values.\n\n- *Default*: undef\n\nperiodic_jobs_manage (boolean)\n------------------------------\nTrigger to control if periodic jobs schedules should be included in /etc/crontab.\n\n- *Default*: true\n\nservice_enable (bool)\n---------------------\nBoolean to enable the cron service.\n\n- *Default*: true\n\nservice_ensure (string)\n-----------------------\nString for the ensure parameter for the cron service. Valid values are 'running' and 'stopped'.\n\n- *Default*: 'running'\n\nservice_name (string)\n---------------------\nName of the cron service. Specify this to change the platform's default.\n\n- *Default*: 'USE_DEFAULTS'\n\nuser_crontabs (hash)\n--------------------\nHash of users and user cronjobs.\n\n- *Default*: undef\n\nuser_crontabs_hiera_merge (bool)\n--------------------\nBoolean flag to turn off and on merging for Hiera.\n\n- *Default*: true\n\n\n## Sample usage:\n\n**Work on Suse**\n\u003cpre\u003e\ncron::cron_allow: 'present'\ncron::cron_allow_users:\n  - root\n\u003c/pre\u003e\n\n**Define crontab variables**\n\u003cpre\u003e\ncron::crontab_vars:\n  SHELL: /bin/bash\n  PATH: /sbin:/bin:/usr/sbin:/usr/bin\n  MAILTO: root\n  HOME: /root\n\u003c/pre\u003e\n\n**Create /etc/cron.daily/daily_task**\n\u003cpre\u003e\ncron::cron_files:\n     'daily_task':\n       ensure: 'present'\n       type: 'daily'\n       content: |\n            #!/bin/bash\n            # This File is managed by puppet\n            command\n\u003c/pre\u003e\n\n**Manage /etc/cron.allow**\n\u003cpre\u003e\ncron::cron_allow: 'present'\ncron::cron_allow_users:\n     - user1\n\u003c/pre\u003e\n\n**Manage /etc/cron.deny**\n\u003cpre\u003e\ncron::cron_deny: 'present'\ncron::cron_deny_users:\n     - user1\n\u003c/pre\u003e\n\n**Manage /etc/crontab**\n\u003cpre\u003e\ncron::crontab_tasks:\n   'task1':\n    - \"* 12 * * 7 username echo 'Hello World'\"\n    - \"2 2 * * 6 username echo 'tes'\"\n   'task2':\n    - \"* 6 * * 7 root echo 'test'\"\n\u003c/pre\u003e\n\n## Define `cron::fragment`\n\n### Parameters\n\nensure (string)\n---------------\nString for the ensure parameter of the cron fragment file. Valid values are 'absent', 'file' and 'present'.\n\n- *Default*: 'absent'\n\ncontent (string)\n----------------\nString to represent contents of cron job.\n\n- *Default*: ''\n\nowner (string)\n--------------\nName of the owner of the fragment file.\n\n- *Default*: 'root'\n\ngroup (string)\n--------------\nName of the group of the fragment file.\n\n- *Default*: 'root'\n\nmode (string)\n-------------\nFilemode of the fragment file. Must use the four-digit octal notation. RegEx: /^[0-7]{4}$/\nBy 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'.\n\n- *Default*: 'USE_DEFAULTS'\n\ntype (string)\n-------------\nThe type of cron job. This generally refers to \"/etc/cron.${type}/\". Valid\nvalues are 'd', 'hourly, 'daily', 'weekly', 'monthly' and 'yearly'.\n\n- *Default*: 'daily'\n\n## Define cron::user::crontab\n\nOften application teams or application users have crontabs that must execute as the application user. This grants the ability to manage those crontab entries.\n\nExample: DBA may want all database systems to have a specific cronjob executed as the oracle or mysql user.\n\n\n*By default this is called from the parent class cron. Data is provided for description.*\n\n\n### Parameters\n\nensure (string)\n---------------\nString for the ensure parameter of the user crontab file.\n\n- *Default*: 'file'\n\nowner (string)\n--------------\nOwner of the user's crontab file. Default is undef which will result in the filename and user being the same.\n\n- *Default*: undef\n\ngroup (string)\n--------------\nGroup owner of the user's crontab file. Default is undef which will result in the filename and group being the same.\n\n- *Default*: undef\n\nmode (string)\n-------------\nFilemode of the user's crontab file. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/\n\n- *Default*: '0600'\n\npath (string)\n-------------\nPath to the user's crontab file. Leave it unset (undef) to use the OS vendor defaults values.\n\n- *Default*: undef\n\ncontent (string)\n----------------\n**Advanced usage** Content of the user's crontab file. **Warning**: Leave alone to use included template.\n\n- *Default*: template('cron/usercrontab.erb')\n\nvars (array)\n------------\nVariables to add to user's crontab file. **Hint**: Will be ignored if $content is set.\n\n- *Default*: undef\n- *undef results in*:\n\u003cpre\u003e\nSHELL=/bin/bash\nPATH=/sbin:/bin:/usr/sbin:/usr/bin\nMAILTO=\u003cuser\u003e\nHOME=/home/\u003cuser\u003e\n\u003c/pre\u003e\n\nentries (hash)\n--------------\nHash of user's and user crontabs. **Hint**: Will be ignored if $content is set.\n\n- *Default*: undef\n\n\n### Usage\n\nSimply insert the hiera data in your hiera hierarchy and there will be a hiera_hash of all hiera levels.\n\nHiera data structure to be used by the parent class cron:\n\u003cpre\u003e\ncron::user_crontabs:\n  'user1':\n    vars:\n      'SHELL': '/bin/bash'\n      'MYECHO': '$(which echo)'\n    entries:\n      '# Echo Hello World':\n        - '* 1 * * * $MYECHO \"Hello World!\" 2\u003e\u00261'\n  'user2':\n    vars:\n      'SHELL': '/bin/bash'\n      'MYECHO': '$(which echo)'\n    entries:\n      '# Echo Hello World':\n        - '* 3 * * * $MYECHO \"Hello user2!\" 2\u003e\u00261'\n\u003c/pre\u003e\n\nExample of how to create resources function outside of the cron module.\n-----------------------------------------------------------------------\n\u003cpre\u003e\n  $user_crontabs =\u003e {\n    'user1' =\u003e {'vars' =\u003e [ 'SHELL': '/bin/bash', 'MYECHO': '$(which echo)' ], 'entries' =\u003e [ '# Echo Hello World': '* 1 * * * $MYECHO \"Hello World!\"' ]},\n    'user2' =\u003e {'vars' =\u003e [ 'SHELL': '/bin/bash', 'MYECHO': '$(which echo)' ], 'entries' =\u003e [ '# Echo Hello World': '* 3 * * * $MYECHO \"Hello user2!\"' ]}\n  }\n  create_resources(cron::user::crontab, $user_crontabs)\n\u003c/pre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericsson%2Fpuppet-module-cron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericsson%2Fpuppet-module-cron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericsson%2Fpuppet-module-cron/lists"}