---

- name: Check if cron is installed
  shell: "set -o pipefail && dpkg -l cron 2>/dev/null | grep -q -E '^(i|h)i'"
  args:
    executable: /bin/bash
  failed_when: False
  changed_when: False
  check_mode: no
  register: is_cron_installed

- name: evocheck crontab is updated
  template:
    src: crontab.j2
    dest: /etc/cron.d/evocheck
    mode: "0644"
    owner: root
    group: root
    force: yes
  when: is_cron_installed.rc == 0
