aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/kernel/tasks/main.yml
blob: 923cb98e1447055f5bd0b9413506ceb6e6b0fe2c (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
- name: Get distro
  ansible.builtin.setup:
    gather_subset:
      - distribution

- name: Fail unless Arch Linux
  when: |
    ansible_facts['distribution'] != 'Archlinux'
  ansible.builtin.fail:
    msg: Only works on Arch Linux

- name: Fail if wrong flavour
  when: |
    kernel_flavour not in ['latest', 'lts']
  ansible.builtin.fail:
    msg: Kernel flavour must be either 'latest' or 'lts'

- name: Install kernels
  become: true
  ansible.builtin.package:
    name:
      - linux
      - linux-headers
      - linux-lts
      - linux-lts-headers

- name: Fail if invalid bootloader
  when: |
    kernel_bootloader not in ['grub', 'systemd-boot']
  ansible.builtin.fail:
    msg: |
      Supported bootloaders are: 'grub', 'systemd-boot'

- name: 'Set up for bootloader {{ kernel_bootloader }}'
  ansible.builtin.include_tasks: '{{ kernel_bootloader }}.yml'

- name: Run handlers if neccessary
  ansible.builtin.meta: flush_handlers