aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/kernel/tasks/grub.yml
blob: bcf83e22ab4250e25c2e53a80816eacb6e1f4210 (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
- name: Set default GRUB entry
  vars:
    kernel_image: |
      {{
        {
          'latest': '/boot/vmlinuz-linux',
          'lts': '/boot/vmlinuz-linux-lts',
        }[kernel_flavour]
      }}
  become: true
  community.general.ini_file:
    create: false
    ignore_spaces: true
    no_extra_spaces: true
    path: /etc/default/grub
    option: GRUB_TOP_LEVEL
    value: '{{ kernel_image }}'

- name: Generate GRUB config
  become: true
  ansible.builtin.command: grub-mkconfig
  changed_when: false
  register: kernel_mkconfig

- name: Update grub.cfg
  become: true
  ansible.builtin.copy:
    content: '{{ kernel_mkconfig.stdout }}'
    dest: /boot/grub/grub.cfg
    owner: root
    group: root
    mode: '0755'
  notify: bootloader_configured