---
# file: roles/incus-client/tasks/main.yml

- name: "https://pkgs.zabbly.com/key.asc"
  ansible.builtin.get_url:
    url: "https://pkgs.zabbly.com/key.asc"
    dest: "/etc/apt/keyrings/zabbly.asc"
  tags: incus

- name: "/etc/apt/sources.list.d/zabbly.sources"
  ansible.builtin.copy:
    content: |
      Enabled: yes
      Types: deb
      URIs: https://pkgs.zabbly.com/incus/{{ incus_repository }}
      Suites: {{ ansible_distribution_release }}
      Components: main
      Architectures: amd64
      Signed-By: /etc/apt/keyrings/zabbly.asc
    dest: "/etc/apt/sources.list.d/zabbly.sources"
  register: repository_incus
  tags: incus

- name: "apt update"
  ansible.builtin.apt:
    update_cache: yes
  when: repository_incus.changed
  tags: incus

- name: "install incus-client"
  ansible.builtin.apt:
    name:
      - incus-client
  tags: incus
