Manage crontab

This role is very simple is use the same parameters of module cron (https://docs.ansible.com/ansible/latest/modules/cron_module.html).

Examples

Cron restart apache2 every 4 hours:

cron_tasks:
  - name: "Restart apache2 - https://tracker.cosium.com/browse/IT-5016"
    minute: "0"
    hour: "*/4"
    job: "systemctl restart apache2.service"

Environnement variable:

cron_tasks:
  - name: MAILTO
    env: yes
    value: ""

Silence /etc/cron.d/ crons

This is an edge case, crons souldn't be managed this way, but you can silence mails from crons inside /etc/cron.d/* files by adding MAILTO="" for root, e.g. with:

crontab_silence_files: [sentry, belgique_demo]

N.B.: only existing files are updated.