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.
This commit is contained in:
1 parent
83e6accdc1
commit
97c64189c5
7 files changed
+159
-104
No files matched your search
@@ -39,40 +39,30 @@
|
||||
- { 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
|
||||
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
|
||||
include_role:
|
||||
name: apt_repos
|
||||
tasks_from: add
|
||||
vars:
|
||||
apt_repo:
|
||||
name: prosody
|
||||
uris: "https://packages.prosody.im/debian"
|
||||
suites: "{{ ansible_facts['distribution_release'] }}"
|
||||
components:
|
||||
- main
|
||||
signed_by: /usr/share/keyrings/prosody-archive-keyring.gpg
|
||||
when: preinstalled == false or preinstalled is not defined
|
||||
|
||||
- name: jitsimeet | add jitsi repository
|
||||
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
|
||||
include_role:
|
||||
name: apt_repos
|
||||
tasks_from: add
|
||||
vars:
|
||||
apt_repo:
|
||||
name: jitsi-stable
|
||||
uris: "https://download.jitsi.org"
|
||||
suites: "stable/"
|
||||
signed_by: /usr/share/keyrings/jitsi-archive-keyring.gpg
|
||||
when: preinstalled == false or preinstalled is not defined
|
||||
|
||||
- name: jitsimeet | flush handlers
|
||||
|
||||
Reference in new issue
Block a user