Files
ansible-pull/roles/mastodon/tasks/system_setup/prepare_packagemanager.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

55 lines
1.5 KiB
YAML
Executable File

- name: mastodon | package manager | install repository dependencies
apt:
name:
- python3-debian # Benötigt für deb822_repository
- apt-transport-https
state: present
- name: mastodon | package manager | download gpg keys
get_url:
url: "{{ item.url }}"
dest: "/usr/share/keyrings/{{ item.localkey }}"
mode: "0644"
loop:
- { url: "https://dl.yarnpkg.com/debian/pubkey.gpg", localkey: "yarn-archive-keyring.gpg" }
- { url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key", localkey: "nodesource-archive-keyring.gpg" }
- name: mastodon | package manager | add yarn repository
include_role:
name: apt_repos
tasks_from: add
vars:
apt_repo:
name: yarn
uris: "https://dl.yarnpkg.com/debian"
suites: stable
components:
- main
signed_by: /usr/share/keyrings/yarn-archive-keyring.gpg
- name: mastodon | package manager | add nodejs repository
include_role:
name: apt_repos
tasks_from: add
vars:
apt_repo:
name: nodejs
types:
- deb
- deb-src
uris: "https://deb.nodesource.com/node_{{ node_major_version }}.x"
suites: "{{ ansible_facts['distribution_release'] }}"
components:
- main
signed_by: /usr/share/keyrings/nodesource-archive-keyring.gpg
- name: mastodon | package manager | remove legacy keyring files
file:
path: "/usr/share/keyrings/{{ item }}"
state: absent
loop:
- yarnkey.gpg
- nodesource.gpg.key
- name: mastodon | package manager | update cache
apt: update_cache=yes