robertdebock.cron

Ansible Role: Cron

This role installs cron and schedules jobs on your system.

GitHub GitLab Downloads Version
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 Build Status GitHub Build Status GitLab

Context

This role is compatible with several other roles. For more details, check out the documentation.

Here’s a visual of related roles: dependencies

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

Apache-2.0.

Author Information

The author is robertdebock.

Feel free to support me.

Informazioni sul progetto

Install cron and scedule jobs on your system.

Installa
ansible-galaxy install robertdebock.cron
Licenza
apache-2.0
Download
432.5k
Proprietario
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.