---
- name: Ensure repository GPG key is present
  ansible.builtin.apt_key:
    url: 'https://archive.heckel.io/apt/pubkey.txt'
    state: present

- name: Ensure Apt repository is present
  apt_repository:
    repo: 'deb [arch=arm64] https://archive.heckel.io/apt debian main'
    filename: ntfy
    state: present

- name: Ensure ntfy is installed
  apt:
    name: ntfy
    state: present

- name: Ensure configuration directory is present
  ansible.builtin.file:
    path: '/etc/ntfy'
    state: directory
    mode: '0755'
    owner: 'root'
    group: 'root'

- name: Ensure client config file is present
  ansible.builtin.template:
    src: 'client.yml.j2'
    dest: '/etc/ntfy/client.yml'
    mode: '0644'
    owner: 'root'
    group: 'root'
