diff --git a/tasks/additional-firmware.yml b/tasks/additional-firmware.yml new file mode 100644 index 0000000..fb099a1 --- /dev/null +++ b/tasks/additional-firmware.yml @@ -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'] diff --git a/tasks/dell-firmware.yml b/tasks/dell-firmware.yml deleted file mode 100644 index 59ca0a2..0000000 --- a/tasks/dell-firmware.yml +++ /dev/null @@ -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" diff --git a/tasks/main.yml b/tasks/main.yml index cc18040..0d801d4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -15,15 +15,15 @@ - name: Import custom fact setting 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 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 ansible.builtin.import_tasks: edit-journald.yml diff --git a/tasks/set-locale.yml b/tasks/set-locale.yml index e0aa1ec..55ff798 100644 --- a/tasks/set-locale.yml +++ b/tasks/set-locale.yml @@ -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 ansible.builtin.debconf: name: locales @@ -7,10 +15,11 @@ vtype: select notify: Reconfigure locales -- name: Generate required locales - ansible.builtin.debconf: - name: locales - question: locales/locales_to_be_generated - value: en_US.UTF-8 UTF-8, nl_NL.UTF-8 UTF-8, en_GB.UTF-8 UTF-8 - vtype: multiselect - notify: Reconfigure locales +# Not needed when using community.general.locale_gen +# - name: Generate required locales +# ansible.builtin.debconf: +# name: locales +# question: locales/locales_to_be_generated +# value: en_US.UTF-8 UTF-8, nl_NL.UTF-8 UTF-8, en_GB.UTF-8 UTF-8 +# vtype: multiselect +# notify: Reconfigure locales diff --git a/templates/etc/ansible/facts.d/cpu_info.fact b/templates/etc/ansible/facts.d/cpu_info.fact index 33a35bc..cf86baf 100755 --- a/templates/etc/ansible/facts.d/cpu_info.fact +++ b/templates/etc/ansible/facts.d/cpu_info.fact @@ -23,6 +23,18 @@ else productname="Unknown" 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 manufacturer=$(cat /sys/devices/virtual/dmi/id/board_vendor | awk '{print $1}') elif [[ "$systemtype" == "Raspberry" ]]; then @@ -33,5 +45,5 @@ else manufacturer="Unknown" fi -printf '{"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" \ No newline at end of file +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"}'\ + "$libreboot" "$systemtype" "$manufacturer" "$productname" "$hostname" "$operating_system" "$architecture" "$processor_model" "$memory" "$system_main_ip" \ No newline at end of file