robertdebock.cron
Ansible Role: Cron
This role installs cron and schedules jobs on your system.
GitHub | GitLab | Downloads | Version |
---|---|---|---|
Example Playbook
Here’s a simple example from molecule/default/converge.yml
, which is automatically tested with each update.
---
- name: Install Cron Jobs
hosts: all
become: true
gather_facts: true
roles:
- role: robertdebock.cron
cron_jobs:
- name: my_job
# Runs every 10 minutes
minute: "*/10"
# At 11 PM
hour: 23
# For the first part of the month
day: "1-15"
# Executes command "ls -l"
job: "ls -l"
# For the root user
user: root
Make sure your machine is set up first. This is done in CI using molecule/default/prepare.yml
:
---
- name: Prepare System
hosts: all
become: true
gather_facts: false
roles:
- role: robertdebock.bootstrap
See a full explanation and examples for using these roles.
Role Variables
Default variable values are set in defaults/main.yml
:
---
# Default settings for cron
# Shell to use for running cron jobs
cron_shell: /bin/bash
# Path for running jobs
cron_path: /sbin:/bin:/usr/sbin:/usr/bin
# Email address for notifications
cron_mailto: root
Requirements
You need the pip packages mentioned in requirements.txt.
Used Roles
The following roles help prepare a system. You can set up your system differently.
Requirement | GitHub | GitLab |
---|---|---|
robertdebock.bootstrap |
Context
This role is compatible with several other roles. For more details, check out the documentation.
Here’s a visual of related roles:
Compatibility
This role works with these container images:
Container | Tags |
---|---|
Alpine | all |
Amazon | Candidate |
EL | 9 |
Debian | all |
Fedora | all |
Ubuntu | all |
You need at least Ansible version 2.12, and testing has been done to ensure compatibility with previous, current, and development versions.
If you find any issues, please report them on GitHub.
License
Author Information
The author is robertdebock.
Feel free to support me.
Install cron and scedule jobs on your system.
ansible-galaxy install robertdebock.cron