Remove uefi entry configuration & add systemd-boot pacman hook

This commit is contained in:
Sonny Bakker 2025-12-18 13:50:22 +01:00
parent a51ba82d32
commit 09fbaf597c
8 changed files with 47 additions and 78 deletions

View file

@ -19,10 +19,6 @@ xdg_script_dir: '{{ ansible_env.HOME }}/.local/bin'
modprobe_templates: [] modprobe_templates: []
mkinitcpio_templates: [] mkinitcpio_templates: []
boot_configuration:
server_domain: fudiggity.nl server_domain: fudiggity.nl
register_uefi_entries: false
wezterm_font_size: 12 wezterm_font_size: 12

View file

@ -50,8 +50,4 @@ mkinitcpio_templates:
- src: 'templates/desktop/mkinitcpio/linux-lts.preset.j2' - src: 'templates/desktop/mkinitcpio/linux-lts.preset.j2'
dest: '/etc/mkinitcpio.d/linux-lts.preset' dest: '/etc/mkinitcpio.d/linux-lts.preset'
boot_configuration:
disk: /dev/sdc
partition: 1
wezterm_font_size: 13 wezterm_font_size: 13

View file

@ -39,9 +39,5 @@ mkinitcpio_templates:
- src: 'templates/htpc/mkinitcpio/linux.preset.j2' - src: 'templates/htpc/mkinitcpio/linux.preset.j2'
dest: '/etc/mkinitcpio.d/linux.preset' dest: '/etc/mkinitcpio.d/linux.preset'
- src: 'templates/htpc/mkinitcpio/linux-lts.preset.j2' - src: "templates/htpc/mkinitcpio/linux-lts.preset.j2"
dest: '/etc/mkinitcpio.d/linux-lts.preset' dest: "/etc/mkinitcpio.d/linux-lts.preset"
boot_configuration:
disk: /dev/sda
partition: 1

View file

@ -42,10 +42,6 @@ packages:
- nvidia-utils - nvidia-utils
- lib32-nvidia-utils - lib32-nvidia-utils
boot_configuration:
disk: /dev/nvme0n1
partition: 1
mkinitcpio_templates: mkinitcpio_templates:
- src: 'templates/xps/mkinitcpio/1-modules.conf.j2' - src: 'templates/xps/mkinitcpio/1-modules.conf.j2'
dest: '/etc/mkinitcpio.conf.d/1-modules.conf' dest: '/etc/mkinitcpio.conf.d/1-modules.conf'

View file

@ -28,47 +28,56 @@
- name: Copy pacman configuration - name: Copy pacman configuration
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: 'templates/pacman.j2' src: "templates/pacman/config.j2"
dest: '/etc/pacman.conf' dest: "/etc/pacman.conf"
owner: root owner: root
group: root group: root
mode: '0644' mode: "0644"
- name: Create extra conf - name: Create extra conf
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: '/etc/pacman.d/extra.conf' path: "/etc/pacman.d/extra.conf"
owner: root owner: root
group: root group: root
state: touch state: touch
mode: '0644' mode: "0644"
- name: Copy systemd-boot pacman hook
become: true
ansible.builtin.template:
src: "templates/pacman/hook.j2"
dest: "/etc/pacman.d/hooks/100-systemd-boot.hook"
owner: root
group: root
mode: "0644"
- name: Setup Wezterm - name: Setup Wezterm
when: "'wezterm' in packages" when: "'wezterm' in packages"
block: block:
- name: Create wezterm configuration dir - name: Create wezterm configuration dir
ansible.builtin.file: ansible.builtin.file:
path: '{{ xdg_config_dir }}/wezterm/includes' path: "{{ xdg_config_dir }}/wezterm/includes"
state: directory state: directory
mode: '0755' mode: "0755"
- name: Copy wezterm configuration files - name: Copy wezterm configuration files
ansible.builtin.template: ansible.builtin.template:
src: '{{ item.src }}' src: "{{ item.src }}"
dest: '{{ item.dest }}' dest: "{{ item.dest }}"
mode: '0755' mode: "0755"
loop: loop:
- src: 'templates/wezterm/wezterm.lua.j2' - src: "templates/wezterm/wezterm.lua.j2"
dest: '{{ xdg_config_dir }}/wezterm/wezterm.lua' dest: "{{ xdg_config_dir }}/wezterm/wezterm.lua"
- src: 'templates/wezterm/includes/colors.lua.j2' - src: "templates/wezterm/includes/colors.lua.j2"
dest: '{{ xdg_config_dir }}/wezterm/includes/colors.lua' dest: "{{ xdg_config_dir }}/wezterm/includes/colors.lua"
- src: 'templates/wezterm/includes/fonts.lua.j2' - src: "templates/wezterm/includes/fonts.lua.j2"
dest: '{{ xdg_config_dir }}/wezterm/includes/fonts.lua' dest: "{{ xdg_config_dir }}/wezterm/includes/fonts.lua"
- src: 'templates/wezterm/includes/window.lua.j2' - src: "templates/wezterm/includes/window.lua.j2"
dest: '{{ xdg_config_dir }}/wezterm/includes/window.lua' dest: "{{ xdg_config_dir }}/wezterm/includes/window.lua"
- name: Enable fstrim timer - name: Enable fstrim timer
become: true become: true
@ -153,53 +162,17 @@
- name: Copy mkinitcpio configuration files - name: Copy mkinitcpio configuration files
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: '{{ item.src }}' src: "{{ item.src }}"
dest: '{{ item.dest }}' dest: "{{ item.dest }}"
mode: '0755' mode: "0755"
loop: '{{ mkinitcpio_templates }}' loop: "{{ mkinitcpio_templates }}"
when: '{{ mkinitcpio_templates | length > 0 }}' when: "{{ mkinitcpio_templates | length > 0 }}"
- name: Regenerate initramfs images - name: Regenerate initramfs images
become: true become: true
ansible.builtin.command: 'mkinitcpio --allpresets' ansible.builtin.command: "mkinitcpio --allpresets"
register: mkinitcpio_stats register: mkinitcpio_stats
- name: Log mkinitcpio stdout - name: Log mkinitcpio stdout
ansible.builtin.debug: ansible.builtin.debug:
var: mkinitcpio_stats.stdout_lines var: mkinitcpio_stats.stdout_lines
- name: Create a Linux UEFI boot entry
become: true
ansible.builtin.command: efibootmgr \
--create \
--disk '{{ boot_configuration.disk }}' \
--part '{{ boot_configuration.partition }}' \
--label 'Arch Linux' \
--loader '\EFI\Linux\linux.efi'\
--unicode
--index 0
register: efi_linux_stats
when: register_uefi_entries
- name: Log efibootmgr stdout
ansible.builtin.debug:
var: efi_linux_stats.stdout_lines
when: register_uefi_entries
- name: Create a Linux LTS UEFI boot entry
become: true
ansible.builtin.command: efibootmgr \
--create \
--disk '{{ boot_configuration.disk }}' \
--part '{{ boot_configuration.partition }}' \
--label 'Arch Linux LTS' \
--loader '\EFI\Linux\linux-lts.efi'\
--unicode
--index 1
register: efi_linux_lts_stats
when: register_uefi_entries
- name: Log efibootmgr LTS stdout
ansible.builtin.debug:
var: efi_linux_lts_stats.stdout_lines
when: register_uefi_entries

View file

@ -26,3 +26,4 @@
dest: '{{ ansible_env.HOME }}/.local/bin/tmux_start' dest: '{{ ansible_env.HOME }}/.local/bin/tmux_start'
mode: '0740' mode: '0740'
force: false force: false
# setup systemd-boot pacman hook

11
templates/pacman/hook.j2 Normal file
View file

@ -0,0 +1,11 @@
# {{ ansible_managed }}
[Trigger]
Type = Package
Operation = Upgrade
Target = systemd
[Action]
Description = Gracefully upgrading systemd-boot...
When = PostTransaction
Exec = /usr/bin/systemctl restart systemd-boot-update.service