cron
Collection: builtin
Full Name: parallax.builtin.cron
Aliases: ansible.builtin.cron, cron
Synopsis
Manage cron
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | yes | Description of the crontab entry or the job name to manage | |
| job | string | The command to execute (required unless state=absent) | ||
| state | string | present | absent or present: whether to ensure the cron job is absent or present | |
| minute | string | * | Minute field for the cron job (0-59, *, */n) | |
| hour | string | * | Hour field for the cron job (0-23, *, */n) | |
| day | string | * | Day of month field for the cron job (1-31, *, */n) | |
| month | string | * | Month field for the cron job (1-12, *, */n) | |
| weekday | string | * | Weekday field for the cron job (0-7, *, */n) | |
| special_time | string | Special time specification Choices: annually, daily, hourly, monthly, reboot, weekly, yearly | ||
| user | string | root | The specific user whose crontab should be modified | |
| cron_file | string | Write cron job to a specific file in /etc/cron.d | ||
| backup | bool | false | Create a backup of the crontab before making changes | |
| disabled | bool | false | Disable the cron job by commenting it out | |
| env | bool | false | If true, manage environment variable assignments in crontab | |
| insertafter | string | If specified, insert job after the matching line | ||
| insertbefore | string | If specified, insert job before the matching line | ||
| reboot | bool | false | Run job at reboot (alias for special_time=reboot) | |
| minute_alias | string | Alias for minute parameter (for compatibility) | ||
| hour_alias | string | Alias for hour parameter (for compatibility) | ||
| day_alias | string | Alias for day parameter (for compatibility) | ||
| month_alias | string | Alias for month parameter (for compatibility) | ||
| weekday_alias | string | Alias for weekday parameter (for compatibility) |
Example
- name: Example cron task
cron:
name: <your_name>