Add systemd-boot role

This commit is contained in:
Przemek Grondek 2024-04-19 20:49:47 +02:00
parent 2eae70f36a
commit 5ae29af922
5 changed files with 83 additions and 0 deletions

View File

@ -2,6 +2,7 @@
- hosts: localhost - hosts: localhost
roles: roles:
- prepare - prepare
- systemd-boot
- ubuntu - ubuntu
- ubuntu-java - ubuntu-java
- ubuntu-firefox - ubuntu-firefox

View File

@ -0,0 +1,69 @@
---
- name: "[Arch] install efi drivers for ext4"
become: yes
community.general.pacman:
update_cache: yes
name:
- efifs
- name: "[Arch] Install systemd-boot"
become: yes
shell:
cmd: |
bootctl --esp-path {{ efs }} --boot-path {{ boot }} install
- name: "[Arch] Copy ext4 driver to systemd drivers"
become: yes
copy:
remote_src: true
content: /usr/lib/efifs-x64/ext2_x64.efi
dest: "{{ efs }}/EFI/systemd/drivers/ext2_x64.efi"
- name: "[Arch] Add main entry"
become: yes
template:
src: loader/entries/arch.conf.j2
dest: "{{ boot }}/loader/entries/arch.conf"
vars:
name: ""
variant: ""
version: "linux"
- name: "[Arch] Add fallback entry"
become: yes
template:
src: loader/entries/arch.conf.j2
dest: "{{ boot }}/loader/entries/arch-fallback.conf"
vars:
name: " Fallback"
variant: "-fallback"
version: "linux"
- name: "[Arch] Check if lts kernel is installed"
stat:
path: "{{ boot }}/vmlinuz-linux-lts"
register: lts_kernel
- name: "[Arch] Add lts entry"
become: yes
template:
src: loader/entries/arch.conf.j2
dest: "{{ boot }}/loader/entries/arch-lts.conf"
vars:
name: " LTS"
variant: ""
version: "linux-lts"
when:
- lts_kernel.stat.exists
- name: "[Arch] Add lts fallback entry"
become: yes
template:
src: loader/entries/arch.conf.j2
dest: "{{ boot }}/loader/entries/arch-lts-fallback.conf"
vars:
name: " LTS Fallback"
variant: "-fallback"
version: "linux-lts"
when:
- lts_kernel.stat.exists

View File

@ -0,0 +1,3 @@
---
- import_tasks: arch.yml
when: ansible_distribution == "Archlinux"

View File

@ -0,0 +1,4 @@
title Arch Linux{{ name }}
linux /vmlinuz-{{ version }}
initrd /initramfs-{{ version }}{{ variant }}.img
options root={{ root }} cryptdevice={{ cryptdevice }} {{ options }}

View File

@ -0,0 +1,6 @@
---
root: /dev/mapper/vgubuntu-root
cryptdevice: /dev/nvme0n1p3:cryptlvm
options: rw add_efi_memmap amd_pstate=active loglevel=3
boot: /boot
efs: /boot/efi