shrink_lv/tasks/cleanup.yml

51 lines
1.7 KiB
YAML

---
- name: Set kernel version and backup extension
ansible.builtin.set_fact:
initramfs_kernel_version: "{{ ansible_facts['kernel'] }}"
initramfs_backup_extension: old
- name: Remove dracut extend boot module
ansible.builtin.file:
path: /usr/lib/dracut/modules.d/99extend_boot
state: absent
- name: Check for initramfs backup file
ansible.builtin.stat:
path: "/boot/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }}"
register: bigboot_initramfs_backup_stat
- name: Restore and remove initramfs backup file
when: bigboot_initramfs_backup_stat['stat']['exists'] | bool
block:
- name: Restore previous initramfs
ansible.builtin.copy:
remote_src: true
src: "/boot/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }}"
dest: "/boot/initramfs-{{ initramfs_kernel_version }}.img"
mode: "0600"
- name: Remove initramfs backup file
ansible.builtin.file:
path: "/boot/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }}"
state: absent
- 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
# - name: Check for Bigboot state log and restore services to pre-Bigboot state
# ansible.builtin.import_tasks: tasks/restore_services.yml
# - name: Cleanup previous Bigboot state log if present
# ansible.builtin.file:
# path: "{{ bigboot_disabled_services_log }}"
# state: absent
# when:
# - bigboot_disabled_services_log_stat['stat']['exists'] | bool
...