Improve vendor-specific firmware handling

This commit is contained in:
waal70
2025-09-02 13:04:30 +02:00
parent c81a592635
commit 056ca23b84
5 changed files with 71 additions and 23 deletions

View File

@@ -0,0 +1,35 @@
---
- name: Fix GRUB nouveau errors and reboot
ansible.builtin.lineinfile:
path: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=".*quiet'
# line: 'GRUB_CMDLINE_LINUX_DEFAULT="quiet"'
line: 'GRUB_CMDLINE_LINUX_DEFAULT="quiet nouveau.modeset=0"'
register: grubfix
when: "'Thinkpad' in ansible_local['cpu_info']['productname']"
- name: Update grub # noqa: no-handler
ansible.builtin.command: update-grub
when: grubfix.changed
changed_when: grubfix.changed
- name: Reboot after fixing GRUB # noqa: no-handler
ansible.builtin.reboot:
when: grubfix.changed
changed_when: grubfix.changed
- name: Install additional firmware
ansible.builtin.apt:
pkg:
- firmware-realtek
- firmware-misc-nonfree
- firmware-iwlwifi
- firmware-sof-signed
state: present
when: "'proxmox_servers' not in group_names"
- name: Install intel-microcode on Intel systems, but only if this is a non-libreboot system
ansible.builtin.apt:
name: intel-microcode
state: present
when: ansible_facts['ansible_processor'][0] == 'Intel' and 'installed' not in ansible_local['cpu_info']['libreboot']

View File

@@ -1,8 +0,0 @@
---
- name: Install Dell firmware
ansible.builtin.apt:
pkg:
- firmware-realtek
- firmware-misc-nonfree
state: present
when: "'proxmox_servers' not in group_names"

View File

@@ -15,15 +15,15 @@
- name: Import custom fact setting - name: Import custom fact setting
ansible.builtin.import_tasks: custom-fact.yml ansible.builtin.import_tasks: custom-fact.yml
- name: Firmware block for x86_64 systems
when: "'Dell' in ansible_board_vendor or 'LENOVO' in ansible_board_vendor"
block:
- name: Import firmware tasks
ansible.builtin.import_tasks: additonal-firmware.yml
- name: Import color-shell tasks for the common-role - name: Import color-shell tasks for the common-role
ansible.builtin.import_tasks: color-shell.yml ansible.builtin.import_tasks: color-shell.yml
- name: Firmware block for Dell servers
when: "'Dell' in ansible_board_vendor"
block:
- name: Import firmware tasks for Dell-based servers
ansible.builtin.import_tasks: dell-firmware.yml
- name: Import journald tasks for the common-role - name: Import journald tasks for the common-role
ansible.builtin.import_tasks: edit-journald.yml ansible.builtin.import_tasks: edit-journald.yml

View File

@@ -1,4 +1,12 @@
--- ---
- name: Ensure the proper locales are present and generated
community.general.locale_gen:
name:
- "nl_NL.UTF-8"
- "en_US.UTF-8"
- "en_GB.UTF-8"
state: present
- name: Set default locale to en_US.UTF-8 - name: Set default locale to en_US.UTF-8
ansible.builtin.debconf: ansible.builtin.debconf:
name: locales name: locales
@@ -7,10 +15,11 @@
vtype: select vtype: select
notify: Reconfigure locales notify: Reconfigure locales
- name: Generate required locales # Not needed when using community.general.locale_gen
ansible.builtin.debconf: # - name: Generate required locales
name: locales # ansible.builtin.debconf:
question: locales/locales_to_be_generated # name: locales
value: en_US.UTF-8 UTF-8, nl_NL.UTF-8 UTF-8, en_GB.UTF-8 UTF-8 # question: locales/locales_to_be_generated
vtype: multiselect # value: en_US.UTF-8 UTF-8, nl_NL.UTF-8 UTF-8, en_GB.UTF-8 UTF-8
notify: Reconfigure locales # vtype: multiselect
# notify: Reconfigure locales

View File

@@ -23,6 +23,18 @@ else
productname="Unknown" productname="Unknown"
fi fi
if [ -f /sys/devices/virtual/dmi/id/bios_vendor ]; then
bios=$(cat /sys/devices/virtual/dmi/id/bios_vendor | awk '{print $1}')
else
bios="Unknown"
fi
if [ "$bios" == "coreboot" ]; then
libreboot="installed"
else
libreboot="not present"
fi
if [ -f /sys/devices/virtual/dmi/id/board_vendor ]; then if [ -f /sys/devices/virtual/dmi/id/board_vendor ]; then
manufacturer=$(cat /sys/devices/virtual/dmi/id/board_vendor | awk '{print $1}') manufacturer=$(cat /sys/devices/virtual/dmi/id/board_vendor | awk '{print $1}')
elif [[ "$systemtype" == "Raspberry" ]]; then elif [[ "$systemtype" == "Raspberry" ]]; then
@@ -33,5 +45,5 @@ else
manufacturer="Unknown" manufacturer="Unknown"
fi fi
printf '{"systemtype":"%s","manufacturer":"%s","productname":"%s","hostname":"%s","operating_system":"%s","architecture":"%s","processor_name":"%s","memory":"%s","system_main_ip":"%s"}'\ printf '{"libreboot":"%s","systemtype":"%s","manufacturer":"%s","productname":"%s","hostname":"%s","operating_system":"%s","architecture":"%s","processor_name":"%s","memory":"%s","system_main_ip":"%s"}'\
"$systemtype" "$manufacturer" "$productname" "$hostname" "$operating_system" "$architecture" "$processor_model" "$memory" "$system_main_ip" "$libreboot" "$systemtype" "$manufacturer" "$productname" "$hostname" "$operating_system" "$architecture" "$processor_model" "$memory" "$system_main_ip"