mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 15:39:58 +00:00
Migrate Archlinux config from GRUB to systemd-boot
This commit is contained in:
@@ -1,21 +1,75 @@
|
||||
---
|
||||
- name: Configure GRUB kernel parameters for NVIDIA hybrid graphics
|
||||
- name: Ensure systemd-boot loader entries directory exists
|
||||
tags: [packages, nvidia]
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/default/grub
|
||||
regexp: '^GRUB_CMDLINE_LINUX='
|
||||
line: 'GRUB_CMDLINE_LINUX="{{ host_grub_cmdline_linux }}"'
|
||||
state: present
|
||||
register: nymph_grub_cmdline
|
||||
when: host_grub_cmdline_linux is defined
|
||||
ansible.builtin.file:
|
||||
path: "{{ host_systemd_boot_esp_path }}/loader/entries"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
when: host_systemd_boot_esp_path is defined
|
||||
|
||||
- name: Regenerate GRUB configuration
|
||||
- name: Check whether systemd-boot is installed
|
||||
tags: [packages, nvidia]
|
||||
ansible.builtin.command: grub-mkconfig -o /boot/grub/grub.cfg
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- bootctl
|
||||
- "--esp-path={{ host_systemd_boot_esp_path }}"
|
||||
- is-installed
|
||||
register: nymph_systemd_boot_state
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when:
|
||||
- host_systemd_boot_esp_path is defined
|
||||
- not ansible_check_mode
|
||||
|
||||
- name: Install systemd-boot
|
||||
tags: [packages, nvidia]
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- bootctl
|
||||
- "--esp-path={{ host_systemd_boot_esp_path }}"
|
||||
- install
|
||||
changed_when: true
|
||||
when:
|
||||
- host_grub_cmdline_linux is defined
|
||||
- nymph_grub_cmdline is changed
|
||||
- host_systemd_boot_esp_path is defined
|
||||
- not ansible_check_mode
|
||||
- nymph_systemd_boot_state.rc | default(1) != 0
|
||||
|
||||
- name: Configure systemd-boot loader defaults
|
||||
tags: [packages, nvidia]
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ host_systemd_boot_esp_path }}/loader/loader.conf"
|
||||
content: |
|
||||
default {{ host_systemd_boot_default }}
|
||||
timeout {{ host_systemd_boot_timeout | default(3) }}
|
||||
console-mode {{ host_systemd_boot_console_mode | default('max') }}
|
||||
editor {{ 'yes' if host_systemd_boot_editor | default(false) else 'no' }}
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
when:
|
||||
- host_systemd_boot_esp_path is defined
|
||||
- host_systemd_boot_default is defined
|
||||
|
||||
- name: Configure systemd-boot Arch entries
|
||||
tags: [packages, nvidia]
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ host_systemd_boot_esp_path }}/loader/entries/{{ item.filename }}"
|
||||
content: |-
|
||||
title {{ item.title }}
|
||||
linux {{ item.linux }}
|
||||
{% for initrd in item.initrds | default([]) %}
|
||||
initrd {{ initrd }}
|
||||
{% endfor %}
|
||||
options {{ item.options }}
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
loop: "{{ host_systemd_boot_entries | default([]) }}"
|
||||
loop_control:
|
||||
label: "{{ item.filename }}"
|
||||
when: host_systemd_boot_esp_path is defined
|
||||
|
||||
- name: Configure NVIDIA power management for hybrid graphics
|
||||
tags: [packages, nvidia]
|
||||
|
||||
Reference in New Issue
Block a user