shrink_lv/tasks/cleanup.yml

32 lines
1.0 KiB
YAML

---
- name: Get kernel version
ansible.builtin.set_fact:
initramfs_kernel_version: "{{ ansible_facts['kernel'] }}"
- 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
...