aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/kernel/tasks/systemd-boot.yml
blob: d1be9b05974e288799350396f4b53721748840dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
- name: Get default command line options
  ansible.builtin.setup:
    gather_subset:
      - cmdline

- name: Current command line
  ansible.builtin.debug:
    var: |
      ansible_facts['cmdline']

- name: Validate command line
  loop:
    - root
    - rw
  when: item not in ansible_facts['cmdline']
  ansible.builtin.fail:
    msg: |
      Expected option {{ item }} was not found in the current config!

- name: Generate bootloader entries
  loop:
    - latest
    - lts
  loop_control:
    loop_var: flavour
  become: true
  ansible.builtin.template:
    src: loader.conf
    dest: '/boot/loader/entries/{{ flavour }}.conf'
    owner: root
    group: root
    mode: '0600'
  notify: bootloader_configured

- name: Set default entry
  become: true
  ansible.builtin.lineinfile:
    path: /boot/loader/loader.conf
    regexp: '^default '
    line: 'default {{ kernel_flavour }}.conf'
    owner: root
    group: root
    mode: '0600'
  notify: bootloader_configured

- name: Remove archinstall entries
  when: kernel_systemd_boot_purge_archinstall
  become: true
  community.general.file_remove:
    path: /boot/loader/entries
    pattern: '\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}_linux.conf'
    use_regex: true
  notify: bootloader_configured