Add systemd-boot role
This commit is contained in:
parent
2eae70f36a
commit
5ae29af922
@ -2,6 +2,7 @@
|
|||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
roles:
|
roles:
|
||||||
- prepare
|
- prepare
|
||||||
|
- systemd-boot
|
||||||
- ubuntu
|
- ubuntu
|
||||||
- ubuntu-java
|
- ubuntu-java
|
||||||
- ubuntu-firefox
|
- ubuntu-firefox
|
||||||
|
69
roles/systemd-boot/tasks/arch.yml
Normal file
69
roles/systemd-boot/tasks/arch.yml
Normal 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
|
3
roles/systemd-boot/tasks/main.yml
Normal file
3
roles/systemd-boot/tasks/main.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: arch.yml
|
||||||
|
when: ansible_distribution == "Archlinux"
|
4
roles/systemd-boot/templates/loader/entries/arch.conf.j2
Normal file
4
roles/systemd-boot/templates/loader/entries/arch.conf.j2
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
title Arch Linux{{ name }}
|
||||||
|
linux /vmlinuz-{{ version }}
|
||||||
|
initrd /initramfs-{{ version }}{{ variant }}.img
|
||||||
|
options root={{ root }} cryptdevice={{ cryptdevice }} {{ options }}
|
6
roles/systemd-boot/vars/main.yml
Normal file
6
roles/systemd-boot/vars/main.yml
Normal 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
|
Loading…
Reference in New Issue
Block a user