Files
ansible-pull/roles/backup/tasks/software/packages_utilities.yml
T
rene 97c64189c5 apt: use deb822_repository only on ansible-core >= 2.15
ansible.builtin.deb822_repository was added in ansible-core 2.15. Hosts
running an older ansible-core cannot use it at all, so gate the choice of
module on the runtime version.

Introduce the shared role apt_repos (tasks_from: add) which takes a
single structured apt_repo dict and:
- uses deb822_repository when ansible_version.full >= 2.15 and removes
  the legacy .list file,
- falls back to apt_repository (still available before its removal in
  2.25) and builds the equivalent 'deb [opts] uri suite components' line
  otherwise.

All six repository definitions now go through the role, keeping the
deb822 and legacy representations in sync from one source of truth. The
backup role's repository task keeps its tags via apply, and its tailscale
install updates the apt cache explicitly since the previously notified
'update apt cache' handler does not exist.
2026-10-23 09:13:42 +02:00

77 lines
2.4 KiB
YAML
Executable File

- name: backup | utilities | install utility packages
tags: packages,system,system setup
package:
state: latest
name:
- sudo
- rsync
- name: backup | utilities | install utilities (arch)
tags: packages,system,system setup
package:
state: latest
name:
- mariadb-clients
when: ansible_facts['distribution'] == "Archlinux"
- name: backup | utilities | install utilities (debian)
tags: packages,system,system setup
package:
state: latest
name:
- mariadb-client
when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
- name: backup | tailscale | install tailscale (arch)
tags: packages,system,system setup,tailscale
package:
name: tailscale
state: latest
when: ansible_facts['distribution'] == "Archlinux"
- name: backup | tailscale | install prerequisites (debian-based)
tags: packages,system,system setup,tailscale
apt:
name:
- apt-transport-https
- ca-certificates
- python3-debian # Benötigt für deb822_repository
state: present
when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
- name: backup | tailscale | add tailscale apt key (debian-based)
tags: packages,system,system setup,tailscale
get_url:
url: "https://pkgs.tailscale.com/stable/{{ ansible_facts['distribution'] | lower }}/{{ ansible_facts['distribution_release'] }}.noarmor.gpg"
dest: /usr/share/keyrings/tailscale-archive-keyring.gpg
mode: '0644'
when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
- name: backup | tailscale | add tailscale repository (debian-based)
tags: packages,system,system setup,tailscale
include_role:
name: apt_repos
tasks_from: add
apply:
tags:
- packages
- system
- system setup
- tailscale
vars:
apt_repo:
name: tailscale
uris: "https://pkgs.tailscale.com/stable/{{ ansible_facts['distribution'] | lower }}"
suites: "{{ ansible_facts['distribution_release'] }}"
components:
- main
signed_by: /usr/share/keyrings/tailscale-archive-keyring.gpg
when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
- name: backup | tailscale | install tailscale (debian-based)
tags: packages,system,system setup,tailscale
apt:
name: tailscale
state: latest
update_cache: true
when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]