---
- name: Enable Grub filesystem check
  ansible.builtin.import_role:
    name: autofsck
    tasks_from: main.yml

- name: Flush handlers to add Grub parameters for fsck
  ansible.builtin.meta: flush_handlers

# Make sure to update the reboot code for the WF environment
# - name: Reboot to run filesystem checks
#   ansible.builtin.reboot:

# - name: Reboot to run filesystem checks
#   ansible.builtin.command: /sbin/shutdown -r +1

# - name: Wait for the reboot to complete
#   ansible.builtin.wait_for_connection:
#     connect_timeout: 20
#     sleep: 10
#     delay: "{{ bigboot_post_reboot_delay | default('70') }}"
#     timeout: "{{ bigboot_reboot_timeout | default('1800') }}"

- name: Reboot host to run filesystem checks
  ansible.builtin.import_role:
    name: verified_reboot

- name: Disable Grub filesystem check
  ansible.builtin.import_role:
    name: autofsck
    tasks_from: cleanup.yml

- name: Flush handlers to remove Grub parameters for fsck
  ansible.builtin.meta: flush_handlers
