---
- name: Setup Cron jobs
  hosts: all

  tasks:

  - name: Touch a file check_cron for monitoring
    cron:
      name: "touch check_cron"
      minute: "*/10"
      job: "/usr/bin/touch /var/local/check_cron &> /dev/null"


  - name: Write number of updates to files for monitoring
    cron:
      name: "check number of updates"
      minute: "*/20"
      job: "LANG=C /usr/bin/dnf -q updateinfo list > /var/local/check_dnf_updates 2>/dev/null"
    when: ansible_os_family == 'RedHat'