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:
1 parent
4f1f9026d6
commit
74140629f3
5 files changed
+124
-34
No files matched your search
@@ -35,6 +35,7 @@
|
||||
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" ]
|
||||
|
||||
@@ -46,12 +47,24 @@
|
||||
mode: '0644'
|
||||
when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
|
||||
|
||||
- name: backup | tailscale | remove legacy repository file (debian-based)
|
||||
tags: packages,system,system setup,tailscale
|
||||
file:
|
||||
path: /etc/apt/sources.list.d/tailscale.list
|
||||
state: absent
|
||||
when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
|
||||
notify: update apt cache
|
||||
|
||||
- name: backup | tailscale | add tailscale repository (debian-based)
|
||||
tags: packages,system,system setup,tailscale
|
||||
apt_repository:
|
||||
repo: "deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] }} main"
|
||||
state: present
|
||||
filename: tailscale
|
||||
deb822_repository:
|
||||
name: tailscale
|
||||
types: deb
|
||||
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" ]
|
||||
notify: update apt cache
|
||||
|
||||
|
||||
@@ -12,6 +12,15 @@
|
||||
daemon_reload: true
|
||||
when: preinstalled == false or preinstalled is not defined
|
||||
|
||||
- name: jitsimeet | install repository dependencies
|
||||
apt:
|
||||
name:
|
||||
- python3-debian # Benötigt für deb822_repository
|
||||
- apt-transport-https
|
||||
- gnupg # Benötigt für gpg --dearmor
|
||||
state: present
|
||||
when: preinstalled == false or preinstalled is not defined
|
||||
|
||||
- name: jitsimeet | download GPG keys
|
||||
get_url:
|
||||
url: "{{ item.url }}"
|
||||
@@ -30,19 +39,39 @@
|
||||
- { name: "jitsi", url: "https://download.jitsi.org/jitsi-key.gpg.key" }
|
||||
when: preinstalled == false or preinstalled is not defined
|
||||
|
||||
- name: jitsimeet | remove legacy prosody repository file
|
||||
file:
|
||||
path: /etc/apt/sources.list.d/prosody.list
|
||||
state: absent
|
||||
notify: apt_update
|
||||
when: preinstalled == false or preinstalled is not defined
|
||||
|
||||
- name: jitsimeet | add prosody repository
|
||||
apt_repository:
|
||||
repo: "deb [signed-by=/usr/share/keyrings/prosody-archive-keyring.gpg] https://packages.prosody.im/debian {{ ansible_facts['distribution_release'] }} main"
|
||||
state: present
|
||||
filename: prosody
|
||||
deb822_repository:
|
||||
name: prosody
|
||||
types: deb
|
||||
uris: "https://packages.prosody.im/debian"
|
||||
suites: "{{ ansible_facts['distribution_release'] }}"
|
||||
components:
|
||||
- main
|
||||
signed_by: /usr/share/keyrings/prosody-archive-keyring.gpg
|
||||
notify: apt_update
|
||||
when: preinstalled == false or preinstalled is not defined
|
||||
|
||||
- name: jitsimeet | remove legacy jitsi repository file
|
||||
file:
|
||||
path: /etc/apt/sources.list.d/jitsi-stable.list
|
||||
state: absent
|
||||
notify: apt_update
|
||||
when: preinstalled == false or preinstalled is not defined
|
||||
|
||||
- name: jitsimeet | add jitsi repository
|
||||
apt_repository:
|
||||
repo: "deb [signed-by=/usr/share/keyrings/jitsi-archive-keyring.gpg] https://download.jitsi.org stable/"
|
||||
state: present
|
||||
filename: jitsi-stable
|
||||
deb822_repository:
|
||||
name: jitsi-stable
|
||||
types: deb
|
||||
uris: "https://download.jitsi.org"
|
||||
suites: "stable/"
|
||||
signed_by: /usr/share/keyrings/jitsi-archive-keyring.gpg
|
||||
notify: apt_update
|
||||
when: preinstalled == false or preinstalled is not defined
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -12,6 +12,7 @@
|
||||
- gnupg # Benötigt für gpg --dearmor
|
||||
- curl
|
||||
- apt-transport-https
|
||||
- python3-debian # Benötigt für deb822_repository
|
||||
state: present
|
||||
update_cache: true
|
||||
register: apt_install
|
||||
@@ -30,12 +31,23 @@
|
||||
creates: /usr/share/keyrings/mongodb-archive-keyring.gpg
|
||||
# Hinweis: Der Pfad /usr/share/keyrings/ ist der empfohlene Ort für Schlüssel, die mit 'signed-by' verwendet werden.
|
||||
|
||||
- name: Remove legacy MongoDB repository file
|
||||
ansible.builtin.file:
|
||||
path: "/etc/apt/sources.list.d/mongodb-org-{{ omada_controller_mongodb_version }}.list"
|
||||
state: absent
|
||||
|
||||
- name: Add MongoDB repository
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg ] https://repo.mongodb.org/apt/debian {{ omada_controller_mongodb_repo_release }}/mongodb-org/{{ omada_controller_mongodb_version }} main"
|
||||
state: present
|
||||
filename: "mongodb-org-{{ omada_controller_mongodb_version }}"
|
||||
update_cache: true
|
||||
ansible.builtin.deb822_repository:
|
||||
name: "mongodb-org-{{ omada_controller_mongodb_version }}"
|
||||
types: deb
|
||||
uris: "https://repo.mongodb.org/apt/debian"
|
||||
suites: "{{ omada_controller_mongodb_repo_release }}/mongodb-org/{{ omada_controller_mongodb_version }}"
|
||||
components:
|
||||
- main
|
||||
architectures:
|
||||
- amd64
|
||||
- arm64
|
||||
signed_by: /usr/share/keyrings/mongodb-archive-keyring.gpg
|
||||
# Der 'signed-by'-Parameter verweist auf den zuvor dearmored Schlüssel.
|
||||
|
||||
- name: Install MongoDB server
|
||||
@@ -43,6 +55,7 @@
|
||||
ansible.builtin.apt:
|
||||
name: mongodb-org-server
|
||||
state: present
|
||||
update_cache: true
|
||||
register: mongodb_install
|
||||
retries: 3
|
||||
until: mongodb_install is success
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
- apt-transport-https
|
||||
- software-properties-common
|
||||
- lsb-release
|
||||
- python3-debian # Benötigt für deb822_repository
|
||||
when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
|
||||
|
||||
- name: webservers | nextcloud | prereq | get php repo key
|
||||
@@ -14,14 +15,23 @@
|
||||
dest: "/usr/share/keyrings/php-sury.gpg"
|
||||
mode: '0644'
|
||||
|
||||
- name: webservers | nextcloud | prereq | remove legacy php repo file
|
||||
ansible.builtin.file:
|
||||
path: /etc/apt/sources.list.d/php-sury.list
|
||||
state: absent
|
||||
|
||||
- name: webservers | nextcloud | prereq | add php repo
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [signed-by=/usr/share/keyrings/php-sury.gpg] https://packages.sury.org/php/ {{ ansible_facts['distribution_release'] | lower }} main"
|
||||
state: present
|
||||
filename: php-sury
|
||||
update_cache: true
|
||||
ansible.builtin.deb822_repository:
|
||||
name: php-sury
|
||||
types: deb
|
||||
uris: "https://packages.sury.org/php/"
|
||||
suites: "{{ ansible_facts['distribution_release'] | lower }}"
|
||||
components:
|
||||
- main
|
||||
signed_by: /usr/share/keyrings/php-sury.gpg
|
||||
|
||||
- name: webservers | nextcloud | prereq | install php
|
||||
ansible.builtin.package:
|
||||
ansible.builtin.apt:
|
||||
state: latest
|
||||
update_cache: true
|
||||
name: "{{ nextcloud_php_packages | map(attribute='package') | list }}"
|
||||
Reference in new issue
Block a user