This role will assume the setup of cron
It's part of the ELAO Ansible stack but can be used as a stand alone component.
- Ansible 1.7.2+
None.
Using ansible galaxy:
ansible-galaxy install elao.cron,1.0
You can add this role as a dependency for other roles by adding the role to the meta/main.yml file of your own role:
dependencies:
- { role: elao.cron }
Name | Type | Description |
---|---|---|
cron restart | Service | Restart cron service |
Name | Default | Type | Description |
---|---|---|---|
elao_cron_jobs.name | string | Description of crontab entry. Must be unique. | |
elao_cron_jobs.job | string | The command to execute. Required if state=present | |
elao_cron_jobs.minute | * | string | Minute when the job should run (0-59, *, */2, etc) |
elao_cron_jobs.hour | * | string | Hour when the job should run (0-23, *, */2, etc) |
elao_cron_jobs.day | * | string | Day of the month the job should run (1-31, *, */2, etc) |
elao_cron_jobs.month | * | string | Month of the year the job should run (1-12, *, */2, etc) |
elao_cron_jobs.weekday | * | string | Day of the week that the job should run (0-6 for Sunday-Saturday, *, etc) |
elao_cron_jobs.cron_file | string | If specified, uses this file in cron.d instead of an individual user's crontab. | |
elao_cron_jobs.user | root | string | The specific user whose crontab should be modified. |
elao_cron_jobs.state | present | string | Whether to ensure the job is present or absent. |
elao_cron_jobs:
# Ensure a job that runs at 2 and 5 exists.
# Creates an entry like "0 5,2 * * ls -alh > /dev/null"
- name: check dirs
minute: 0
hour: 5,2
job: "ls -alh > /dev/null"
# Ensure an old job is no longer present. Removes any job that is prefixed
# by "#Ansible: an old job" from the crontab
- name: an old job"
state: absent
- hosts: servers
roles:
- { role: elao.cron }
MIT