--- - name: Incus - Add package repository (apt) hosts: all gather_facts: true gather_subset: - "distribution_release" vars: task_release: "{{ incus_release | default('stable') }}" task_roles: "{{ incus_roles | default(['standalone', 'ui']) }}" any_errors_fatal: true tasks: - name: Check if distribution is supported ansible.builtin.meta: end_play when: 'ansible_distribution not in ("Ubuntu", "Debian")' - name: Create apt keyring path ansible.builtin.file: path: /etc/apt/keyrings/ mode: "0755" state: directory when: 'task_roles | length > 0 and task_release != "distro"' - name: Add Zabbly repository key ansible.builtin.copy: src: files/zabbly-key.asc dest: /etc/apt/keyrings/ansible-zabbly.asc mode: "0644" notify: Update apt become: true when: 'task_roles | length > 0 and task_release != "distro"' - name: Get DPKG architecture ansible.builtin.shell: dpkg --print-architecture register: dpkg_architecture changed_when: false check_mode: false when: 'task_roles | length > 0 and task_release != "distro"' - name: Add Zabbly package source ansible.builtin.template: src: files/incus.sources.tpl dest: /etc/apt/sources.list.d/ansible-zabbly-incus-{{ task_release }}.sources notify: Update apt become: true when: 'task_roles|length > 0 and task_release != "distro"' - name: Handle apt by flushing handlers meta: flush_handlers handlers: - name: Update apt ansible.builtin.apt: force_apt_get: true update_cache: true cache_valid_time: 0 become: true