- block:
  - name: Install grub
    apt:
      name:
        - grub-efi-amd64
        - grub-common
      cache_valid_time: "{{ apt_cache_valid_time }}"

  - name: Install no-op "update-grub"
    copy:
      src: update-grub
      dest: /usr/sbin/update-grub
      owner: root
      group: root
      mode: '755'

  - name: Write linux boot parameters to file for kexec to read
    copy:
      content: "{{ linux_bootparams }}"
      dest: /boot/grub/linux_bootparams
      owner: root
      group: root
      mode: '644'

  - name: Install grub config
    template:
      src: grub.cfg
      dest: /boot/grub/grub.cfg
      owner: root
      group: root
      mode: '644'

  - name: Disable grub service
    service:
      name: grub-common
      enabled: no

  - name: Create EFI mount point
    file:
      state: directory
      dest: /boot/efi
      owner: root
      group: root

  become: yes
