repo: Move ansible setup to root dir

This commit is contained in:
Marty Oehme 2025-07-16 22:33:28 +02:00
parent ff718b46ef
commit 6a1e01575c
Signed by: Marty
GPG key ID: 4E535BC19C61886E
41 changed files with 0 additions and 172 deletions

View file

@ -0,0 +1,56 @@
---
- 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