apt: migrate apt_repository to deb822_repository

apt_repository is deprecated in favor of deb822_repository and will be
removed in ansible-core 2.25. Convert all six call sites (jitsimeet,
tailscale, mongodb/omada, php-sury/nextcloud, yarn/nodejs/mastodon),
install python3-debian as a dependency where required, remove the legacy
.list files so repositories are not duplicated, and update the apt cache
explicitly where deb822_repository no longer does it.

Also replace the remaining bare ansible_lsb.codename with
ansible_facts['distribution_release'] in the mastodon role.
This commit is contained in:
rene committed 2026-10-22 19:21:09 +02:00
1 parent 4f1f9026d6
commit 74140629f3
5 files changed
+124 -34

No files matched your search

@@ -1,3 +1,10 @@
- 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 | add gpg keys
apt_key:
id: "{{ item.id }}"
@@ -15,18 +22,36 @@
- { url: "https://dl.yarnpkg.com/debian/pubkey.gpg", localkey: "yarnkey.gpg" }
- { url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key", localkey: "nodesource.gpg.key" }
- name: mastodon | package manager | add repos
apt_repository:
repo: "{{ item.repo }}"
state: present
mode: 0644 # not required. The octal mode for newly created files in sources.list.d
update_cache: no
validate_certs: yes # not required. If C(no), SSL certificates for the target repo will not be validated. This should only be used on personally controlled sites using self-signed certificates.
filename: "{{ item.filename }}"
- name: mastodon | package manager | remove legacy repository files
file:
path: "/etc/apt/sources.list.d/{{ item }}.list"
state: absent
loop:
- { repo: "deb https://dl.yarnpkg.com/debian stable main", filename: "yarn"}
- { repo: "deb [signed-by=/usr/share/keyrings/nodesource.gpg.key] https://deb.nodesource.com/node_{{ node_major_version }}.x {{ ansible_lsb.codename }} main", filename: "nodejs"}
- { repo: "deb-src [signed-by=/usr/share/keyrings/nodesource.gpg.key] https://deb.nodesource.com/node_{{ node_major_version }}.x {{ ansible_lsb.codename }} main", filename: "nodejs"}
- yarn
- nodejs
- name: mastodon | package manager | add yarn repository
deb822_repository:
name: yarn
types: deb
uris: "https://dl.yarnpkg.com/debian"
suites: stable
components:
- main
mode: "0644"
- name: mastodon | package manager | add nodejs repository
deb822_repository:
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.gpg.key
mode: "0644"
- name: mastodon | package manager | update cache
apt: update_cache=yes