Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/boutetnico/ansible-role-cron

Manage cron jobs with Ansible.
https://github.com/boutetnico/ansible-role-cron

ansible cron debian ubuntu

Last synced: about 4 hours ago
JSON representation

Manage cron jobs with Ansible.

Awesome Lists containing this project

README

        

[![tests](https://github.com/boutetnico/ansible-role-cron/workflows/Test%20ansible%20role/badge.svg)](https://github.com/boutetnico/ansible-role-cron/actions?query=workflow%3A%22Test+ansible+role%22)
[![Ansible Galaxy](https://img.shields.io/badge/galaxy-boutetnico.cron-blue.svg)](https://galaxy.ansible.com/boutetnico/cron)

ansible-role-cron
=================

This role configures cron jobs.

Requirements
------------

Ansible 2.10 or newer.

Supported Platforms
-------------------

- [Debian - 11 (Bullseye)](https://wiki.debian.org/DebianBullseye)
- [Debian - 12 (Bookworm)](https://wiki.debian.org/DebianBookworm)
- [Ubuntu - 22.04 (Jammy Jellyfish)](http://releases.ubuntu.com/22.04/)
- [Ubuntu - 24.04 (Noble Numbat)](http://releases.ubuntu.com/24.04/)

Role Variables
--------------

| Variable | Required | Default | Choices | Comments |
|-------------------------|----------|-----------------------|-----------|------------------------------------------------|
| cron_dependencies | yes | `[cron]` | list | |
| cron_jobs | yes | `[]` | list | Cron jobs to install. See `defaults/main.yml`. |

Dependencies
------------

None

Example Playbook
----------------

- hosts: all
roles:
- ansible-role-cron
cron_jobs:
- name: "run backup script every 6 hours as admin"
job: backup.sh
hour: "*/6"
minute: 0
user: admin
- name: "delete files in /tmp every hour as root"
job: "rm -rf /tmp"
special_time: "hourly"
- name: "rsync files between 2 directories every 15 minutes using /etc/cron.d/rsync as root"
job: "rsync -a /mnt /backup"
cron_file: "rsync"
user: root
- name: "backup database daily using /etc/cron.d/backup_database as admin"
job: "/home/admin/mysqldump.sh"
cron_file: "backup_database"
special_time: "daily"
user: admin

Testing
-------

molecule test

License
-------

MIT

Author Information
------------------

[@boutetnico](https://github.com/boutetnico)