---
- name: Install basic
  package:
    name:
      - rsync
      - psmisc
      - ncat
      - nmap
      - bind9-dnsutils
      - ldnsutils
      - htop
      - unattended-upgrades
      - jq
      - ripgrep
    state: present
- name: Install mailer
  package:
    name:
      - nullmailer
    state: present
  when:
    - mail_nullmailer is defined
    - mail_nullmailer
- name: Copy service executable
  copy:
    src: files/onmon.sh
    dest: /usr/local/bin/onmon.sh
    mode: "0750"
    owner: "root"
    group: "root"
- name: Copy service file
  copy:
    src: files/onmon.service
    dest: /etc/systemd/system/onmon.service
    mode: "0640"
    owner: "root"
    group: "root"
- name: Ensure online monitor is enabled
  systemd:
    name: onmon.service
    enabled: true
    state: started
    daemon_reload: true