debops.cron default variables

General configuration

cron__enabled

Enable or disable cron management using this role.

cron__enabled: True
cron__base_packages

List of APT packages to install for cron support.

cron__base_packages: [ 'cron' ]
cron__packages

List of additional APT packages to install with cron.

cron__packages: []

Configuration of the periodic system jobs

cron__crontab_deploy_state

If present, the custom /etc/crontab configuration will be applied on the host. If absent, the original configuration will be restored.

cron__crontab_deploy_state: 'present'
cron__crontab_seed

A string which is used as the base of the random seed used to generate various crontab(5) time parameters. It should be unique on each host in the Ansible inventory.

cron__crontab_seed: '{{ inventory_hostname }}'
cron__crontab_offset_seeds

A list of pseudo-random strings which are randomly added to the base seed in variouse crontab(5) entries. High number of pseudo-random strings gives more variety in the final configuration entries. At least 8 seed strings are required by the default configuration.

The offset seeds will be stored on the remote hosts in the local fact script to ensure idempotency.

cron__crontab_offset_seeds: '{{ ansible_local.cron.crontab_offset_seeds
                                if (ansible_local|d() and ansible_local.cron|d() and
                                    ansible_local.cron.crontab_offset_seeds|d())
                                else ((ansible_all_ipv4_addresses
                                       + ansible_all_ipv6_addresses
                                       + (ansible_default_ipv4.values() | d([])) | list
                                       + [ ansible_machine_id|d(), ansible_memtotal_mb ]
                                       + [ ansible_product_name, ansible_product_version ]
                                       + [ ansible_kernel ])
                                      | map("regex_replace", "^(.*)$",
                                            (ansible_date_time.epoch|string + "\1"))
                                      | map("hash", "sha256") | list | unique) }}'
cron__crontab_hours

YAML list which defines the hours which will be used in the daily, weekly and monthly crontab(5) entries. The role will randomly select an hour for each job type. The default allows job execution outside of normal workday hours.

cron__crontab_hours: [ 0, 1, 2, 3, 4, 5, 6,
                       18, 19, 20, 21, 22, 23 ]
cron__crontab_weekday_days

YAML list which specifies the days of the week which will be used by the weekly crontab(5) entry. The default will execute the jobs on one of the weekend days only.

cron__crontab_weekday_days: [ 6, 7 ]
cron__crontab_day_ranges

YAML list which specifies the range of days to use in the monthly crontab(5) entry. The default is selected to ensure that jobs are executed on the first week of each month.

cron__crontab_day_ranges: [ 1, 7 ]
cron__crontab_default_environment

YAML dictionary which defines default set of environment variables set in the crontab(5) configuration file. Each key is a variable name and its value is the contents of the variable.

cron__crontab_default_environment:
  SHELL: '/bin/sh'
  PATH: '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin'
cron__crontab_environment

YAML dictionary with environment variables set in the crontab(5) configuration file, defined for all hosts in the Ansible inventory.

cron__crontab_environment: {}
cron__crontab_group_environment

YAML dictionary with environment variables set in the crontab(5) configuration file, defined for hosts in a specific Ansible inventory group.

cron__crontab_group_environment: {}
cron__crontab_host_environment

YAML dictionary with environment variables set in the crontab(5) configuration file, defined for specific hosts in the Ansible inventory.

cron__crontab_host_environment: {}
cron__crontab_combined_environment

Variable which combines all other crontab(5) environment variables and is used in the template.

cron__crontab_combined_environment: '{{ cron__crontab_default_environment
                                        | combine(cron__crontab_environment,
                                                  cron__crontab_group_environment,
                                                  cron__crontab_host_environment) }}'
cron__crontab_default_jobs

A list of the default crontab(5) system jobs defined by the role. See cron__crontab_jobs for more details.

cron__crontab_default_jobs:

  - name: 'crontab-hourly'
    minute: '{{ 59 | random(seed=(cron__crontab_seed
                                  + (cron__crontab_offset_seeds
                                     | random(seed=cron__crontab_offset_seeds[0])))) }}'
    user: 'root'
    job: 'cd / && run-parts --report /etc/cron.hourly'

  - name: 'crontab-daily'
    minute: '{{ 59 | random(seed=(cron__crontab_seed
                                  + (cron__crontab_offset_seeds
                                     | random(seed=cron__crontab_offset_seeds[1])))) }}'
    hour: '{{ cron__crontab_hours | random(seed=(cron__crontab_seed
                                                 + (cron__crontab_offset_seeds
                                                    | random(seed=cron__crontab_offset_seeds[2])))) }}'
    user: 'root'
    job: 'test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )'

  - name: 'crontab-weekly'
    minute: '{{ 59 | random(seed=(cron__crontab_seed
                                  + (cron__crontab_offset_seeds
                                     | random(seed=cron__crontab_offset_seeds[3])))) }}'
    hour: '{{ cron__crontab_hours | random(seed=(cron__crontab_seed
                                                 + (cron__crontab_offset_seeds
                                                    | random(seed=cron__crontab_offset_seeds[4])))) }}'
    weekday: '{{ cron__crontab_weekday_days
                 | random(seed=(cron__crontab_seed
                                + (cron__crontab_offset_seeds
                                   | random(seed=cron__crontab_offset_seeds[5])))) }}'
    user: 'root'
    job: 'test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )'

  - name: 'crontab-monthly'
    minute: '{{ 59 | random(seed=(cron__crontab_seed
                                  + (cron__crontab_offset_seeds
                                     | random(seed=cron__crontab_offset_seeds[6])))) }}'
    hour: '{{ cron__crontab_hours | random(seed=(cron__crontab_seed
                                                 + (cron__crontab_offset_seeds
                                                    | random(seed=cron__crontab_offset_seeds[7])))) }}'
    day: '{{ cron__crontab_day_ranges[1]
             | random(start=cron__crontab_day_ranges[0],
                      seed=(cron__crontab_seed
                            + (cron__crontab_offset_seeds
                               | random(seed=cron__crontab_offset_seeds[8])))) }}'
    user: 'root'
    job: 'test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )'
cron__crontab_jobs

A list of the crontab(5) system jobs defined on all hosts in the Ansible inventory. See cron__crontab_jobs for more details.

cron__crontab_jobs: []
cron__crontab_group_jobs

A list of the crontab(5) system jobs defined on hosts in a specific Ansible inventory group. See cron__crontab_jobs for more details.

cron__crontab_group_jobs: []
cron__crontab_host_jobs

A list of the crontab(5) system jobs defined on specific hosts in the Ansible inventory. See cron__crontab_jobs for more details.

cron__crontab_host_jobs: []
cron__crontab_combined_jobs

The variable which combines other crontab(5) job variables and is used in the role template.

cron__crontab_combined_jobs: '{{ cron__crontab_default_jobs
                                 + cron__crontab_jobs
                                 + cron__crontab_group_jobs
                                 + cron__crontab_host_jobs }}'

Scheduled job configuration

The variables below define cron jobs managed by the cron Ansible module. See cron__jobs for more details.

cron__default_jobs

YAML dictionary with a set of default cron jobs to configure on a host (currently none).

cron__default_jobs: {}
cron__dependent_jobs

YAML dictionary with a set of cron jobs defined by other Ansible roles through the role dependent variables.

cron__dependent_jobs: {}
cron__jobs

YAML dictionary with a set of cron jobs defined for all hosts in the Ansible inventory.

cron__jobs: {}
cron__group_jobs

YAML dictionary with a set of cron jobs defined for hosts in a given Ansible inventory group.

cron__group_jobs: {}
cron__host_jobs

YAML dictionary with a set of cron jobs defined for specific hosts in the Ansible inventory.

cron__host_jobs: {}
cron__combined_jobs

YAML dictionary which combines the cron jobs defined in other variables. This variable is used in the Ansible tasks.

cron__combined_jobs: '{{ lookup("template",
                         "lookup/cron__combined_jobs.j2",
                         convert_data=False) | from_yaml }}'