---
- name: Set kernel parameters
  lineinfile:
    dest: /etc/default/grub
    regexp: '^GRUB_CMDLINE_LINUX_DEFAULT'
    state: present
    line: 'GRUB_CMDLINE_LINUX_DEFAULT="{{ kernel_parameters }}"'
  when: kernel_parameters is defined
  notify:
    - rebuild grub

- name: Disable Grub submenus
  lineinfile:
    dest: /etc/default/grub
    regexp: '^GRUB_DISABLE_SUBMENU'
    state: present
    line: 'GRUB_DISABLE_SUBMENU=y'
  notify:
    - rebuild grub

- name: Install Grub Pacman hook
  kewlfft.aur.aur:
    name: grub-hook
  become: yes
  become_user: "{{ aur.user }}"
  tags:
    - aur
