95 lines
4.1 KiB
YAML
95 lines
4.1 KiB
YAML
---
|
|
- name: Load hardware package definitions
|
|
ansible.builtin.include_vars:
|
|
file: hardware.yml
|
|
|
|
- name: Validate hardware support for current os_family
|
|
ansible.builtin.assert:
|
|
that:
|
|
- os_family in bootstrap_hardware_packages
|
|
- hardware_profile_active is defined
|
|
fail_msg: >-
|
|
Hardware feature requested but no package map for os_family
|
|
'{{ os_family }}'. Extend roles/bootstrap/vars/hardware.yml.
|
|
quiet: true
|
|
|
|
# nvidia_driver: auto -> open (Turing+) -> proprietary (older, if family ships it)
|
|
# -> nouveau (fallback). Explicit value falls back to nouveau when
|
|
# the family lacks packages for it.
|
|
- name: Resolve Nvidia driver flavor
|
|
vars:
|
|
_family: "{{ bootstrap_hardware_packages[os_family] }}"
|
|
_user_driver: "{{ system_cfg.features.gpu.nvidia_driver | default('auto') }}"
|
|
_has_nvidia: "{{ 'nvidia' in (hardware_profile_active.gpus | default([]) | difference(_hardware_profile_disable | default([]))) }}"
|
|
_supports_open: "{{ hardware_profile_active.nvidia_supports_open | default(true) | bool }}"
|
|
_open_pkgs: "{{ _family.gpu_nvidia.open | default([]) }}"
|
|
_prop_pkgs: "{{ _family.gpu_nvidia.proprietary | default([]) }}"
|
|
_auto_choice: >-
|
|
{{
|
|
('open' if _supports_open and _open_pkgs | length > 0
|
|
else ('proprietary' if _prop_pkgs | length > 0
|
|
else 'nouveau'))
|
|
}}
|
|
_user_choice: >-
|
|
{{
|
|
_auto_choice if _user_driver == 'auto'
|
|
else (_user_driver
|
|
if (_family.gpu_nvidia[_user_driver] | default([]) | length > 0)
|
|
else 'nouveau')
|
|
}}
|
|
ansible.builtin.set_fact:
|
|
_nvidia_driver_resolved: "{{ _user_choice if _has_nvidia else 'nouveau' }}"
|
|
|
|
# Fedora's akmod-nvidia* packages live in RPMFusion non-free, which is not
|
|
# enabled out of the box; install the release RPM before the package step.
|
|
- name: Enable RPMFusion non-free for Fedora Nvidia install
|
|
when:
|
|
- os_family == 'RedHat'
|
|
- os == 'fedora'
|
|
- system_cfg.features.gpu.enabled | bool
|
|
- _nvidia_driver_resolved in ['open', 'proprietary']
|
|
ansible.builtin.command: >-
|
|
{{ chroot_command }} dnf install -y
|
|
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ os_version_major }}.noarch.rpm
|
|
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{{ os_version_major }}.noarch.rpm
|
|
register: _rpmfusion_result
|
|
changed_when: _rpmfusion_result.rc == 0
|
|
|
|
- name: Resolve hardware package set
|
|
ansible.builtin.include_tasks: _resolve_hardware_packages.yml
|
|
|
|
- name: Report hardware package selection
|
|
ansible.builtin.debug:
|
|
msg: >-
|
|
Hardware install ({{ os_family }}):
|
|
cpu={{ hardware_profile_active.cpu | default('-') }},
|
|
gpus={{ hardware_profile_active.gpus | default([]) | join(',') | default('-', true) }},
|
|
nvidia_driver={{ _nvidia_driver_resolved }},
|
|
wireless={{ hardware_profile_active.wireless | default([]) | join(',') | default('-', true) }},
|
|
fingerprint={{ hardware_profile_active.fingerprint | default(false) }}
|
|
-> {{ _hardware_packages | length }} package(s)
|
|
|
|
- name: Note Intel IPU6 camera (out-of-tree stack)
|
|
when: hardware_profile_active.camera.ipu6 | default(false) | bool
|
|
ansible.builtin.debug:
|
|
msg: >-
|
|
Intel IPU6 MIPI camera detected. Its driver stack (intel-ipu6 firmware,
|
|
DKMS module, v4l2-relayd, libcamera) is out-of-tree/AUR and is NOT auto-
|
|
installed. Pin the packages in a hardware group via
|
|
system.features.hardware.packages[{{ os_family }}].
|
|
|
|
- name: Install hardware packages
|
|
when: _hardware_packages | length > 0
|
|
vars:
|
|
_install_commands:
|
|
RedHat: >-
|
|
{{ chroot_command }} dnf --releasever={{ os_version_major }}
|
|
--setopt=install_weak_deps=False install -y {{ _hardware_packages | join(' ') }}
|
|
Debian: >-
|
|
{{ chroot_command }} apt install -y {{ _hardware_packages | join(' ') }}
|
|
Archlinux: >-
|
|
pacstrap /mnt {{ _hardware_packages | join(' ') }}
|
|
ansible.builtin.command: "{{ _install_commands[os_family] }}"
|
|
register: _hardware_install_result
|
|
changed_when: _hardware_install_result.rc == 0
|