This role installs cron and schedules jobs on a Linux system.
None.
cron_backup_original_crontab: trueWhether to backup the original crontab before modifying it.
cron_jobs: []
# cron_jobs:
# - name: Foo
# minute: "0"
# hour: "0"
# day: "*"
# month: "4"
# weekday: "*"
# job: "foo.sh"
# state: present
# user: "{{ ansible_user }}"A list of options in order to schedule the specified job. These options are:
name: The name of the job. (required)minute: Minute when the job will be run. Possible values are between 0-59. (optional)hour: Hour of the day when the job will be run. Possible values are between 0-23. (optional)day: Day of the month the job will be run. Possible values are between 1-31. (optional)month: Month the job will be run. Possible values are between 1-12. (optional)weekday: Day of the week the job will be run. Possible values are between 0-6. (optional)special_time: Can be used instead of hour, minute etc. Possible values are:annually,daily,hourly,monthly,reboot,weekly,yearly. (optional)job: The script/command etc to execute. (required)state: Possible values are:present, which will ensure the job is present, andabsentwhich will delete the job. Defaults topresent. (optional)user: Which user's crontab to modify. Defaults to the root user. (optional)
Note: If any of the (optional) options are not specified they will be omitted.
None.
- hosts: server
vars:
cron_jobs:
- name: Test
minute: "0"
hour: "5,2"
job: "/path/to/foo.sh"
state: present
- name: Test 2
state: absent
roles:
- { role: chzerv.cron }MIT / BSD
Xristos Zervakis