---
-
  name: "Installing ClamAV"
  when: ansible_os_family == 'Debian'
  ansible.builtin.apt:
    name:
      - clamav

-
  name: 'Running Freshclam'
  ansible.builtin.shell: freshclam
  when: ansible_os_family == 'Debian'

-
  name: "Adding ClamScan Cron Job Script"
  when: ansible_os_family == 'Debian' and (deb_architecture.stdout == 'arm64' or deb_architecture.stdout == 'armhf')
  ansible.builtin.template:
    mode: a+x
    dest: "{{ item.dest }}"
    src: "{{ item.src }}"
  with_items:
    -
      src: clamscan-cron.sh.j2
      dest: "/usr/local/bin/clamscan-cron.sh"

-
  name: "Ensure a job that Scans Home at two and five"
  ansible.builtin.cron:
    name: "Scan Dirs"
    minute: "0"
    hour: "5,2"
    job: "clamscan-cron.sh"

-
  name: "Disabling postfix"
  when: ansible_os_family == 'Debian'
  ansible.builtin.service:
    name: postfix
    state: stopped
    enabled: false

