ansible.cron(3) - Linux man page

Name

cron - Manage crontab entries.

Description

Use this module to manage crontab entries. This module allows you to create named crontab entries, update, or delete them.

The module includes one line with the description of the crontab entry "#Ansible: <name>" corresponding to the "name" passed to the module, which is used by future ansible/module calls to find/check the state.

Options

backup

If set, then create a backup of the crontab before it is modified.The location of the backup is returned in the backup variable by this module.

day

Day of the month the job should run ( 1-31, *, */2, etc ) (default: *)

hour

Hour when the job should run ( 0-23, *, */2, etc ) (default: *)

job

The command to execute.Required if state=present.

minute

Minute when the job should run ( 0-59, *, */2, etc ) (default: *)

month

Month of the year the job should run ( 1-12, *, */2, etc ) (default: *)

name

Description of a crontab entry.(required)

reboot

If the job should be run at reboot, will ignore minute, hour, day, and month settings in favour of @reboot(Added in Ansible version 1.0.)

state

Whether to ensure the job is present or absent. (default: present)

user

The specific user who's crontab should be modified. (default: root)

weekday
Day of the week that the job should run ( 0-7 for Sunday - Saturday, or mon, tue, * etc ) (default: *)."

Examples

Ensure a job that runs at 2 and 5 exists. Creates an entry like "* 5,2 * * ls -alh > /dev/null"

cron: name="check dirs" hour="5,2" job="ls -alh > /dev/null"
Ensure an old job is no longer present. Removes any job that is preceded by "#Ansible: an old job" in the crontab
cron: name="an old job" cron job="/some/dir/job.sh" state=absent
Creates an entry like "@reboot /some/job.sh"
cron: name="a job for reboot" reboot=True job="/some/job.sh"

Author

Dane Summers

See Also

ansible(1), http://ansible.github.com/modules.html#cron