Move extrapackage installation into separate role and make it more flexible

- Introduce `extra_pkgs1` - `extra_pkgs10`
- Introduce `extra_pkgs_bpo1` - `extra_pkgs_bpo10`
- Move package-list from lmn_teacherlaptop into inventory as extra_pkgs1
This commit is contained in:
Finn Hercke 2025-03-24 10:30:32 +01:00
parent 4dafbd8b85
commit c00d5566dd
8 changed files with 482 additions and 482 deletions

View file

@ -0,0 +1,2 @@
extra_pkgs: []
extra_pkgs_bpo: []

View file

@ -0,0 +1,27 @@
---
- name: Merge extra_pkgs and extra_pkgs_bpo lists
ansible.builtin.set_fact:
extra_pkgs: "{{ extra_pkgs + lookup('vars', 'extra_pkgs' + item, default=[]) }}"
extra_pkgs_bpo: "{{ extra_pkgs_bpo + lookup('vars', 'extra_pkgs_bpo' + item, default=[]) }}"
loop: "{{ range(1, 11) | map('string') | list }}"
- name: Install extra packages from stable
ansible.builtin.apt:
name: "{{ extra_pkgs }}"
when: extra_pkgs|length
- name: Add backports for {{ ansible_distribution_release }}
ansible.builtin.apt_repository:
repo: >
deb http://deb.debian.org/debian/ {{ ansible_distribution_release }}-backports
main non-free-firmware
state: present
update_cache: true
when: extra_pkgs_bpo|length
- name: Install extra packages from backports
ansible.builtin.apt:
name: "{{ extra_pkgs_bpo }}"
state: latest # noqa package-latest
default_release: "{{ ansible_distribution_release }}-backports"
when: extra_pkgs_bpo|length