add cleanup in the event of execution interruption
This commit is contained in:
parent
baa89926c6
commit
9a6ff8ee86
@ -7,26 +7,30 @@
|
|||||||
|
|
||||||
vars:
|
vars:
|
||||||
bigboot_size_target: 1G
|
bigboot_size_target: 1G
|
||||||
|
initramfs_backup_extension: old
|
||||||
ansible_ssh_retries: 10
|
ansible_ssh_retries: 10
|
||||||
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Capture boot device details
|
- name: Cleanup from any previous executions
|
||||||
ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml
|
ansible.builtin.import_tasks: tasks/cleanup.yml
|
||||||
|
|
||||||
- name: Capture logical volume information
|
# - name: Capture boot device details
|
||||||
ansible.builtin.import_tasks: tasks/capture_lv_device_details.yml
|
# ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml
|
||||||
|
|
||||||
- name: Set environment for subsequent workflow nodes
|
# - name: Capture logical volume information
|
||||||
ansible.builtin.set_stats:
|
# ansible.builtin.import_tasks: tasks/capture_lv_device_details.yml
|
||||||
data:
|
|
||||||
bigboot_execute_bigboot: "{{ bigboot_execute_bigboot }}"
|
# - name: Set environment for subsequent workflow nodes
|
||||||
bigboot_execute_shrink_lv: "{{ bigboot_execute_shrink_lv }}"
|
# ansible.builtin.set_stats:
|
||||||
bigboot_adjacent_lvm_device: "{{ bigboot_adjacent_lvm_device | trim }}"
|
# data:
|
||||||
bigboot_lv_shrink_size: "{{ bigboot_lv_shrink_size | int }}"
|
# bigboot_execute_bigboot: "{{ bigboot_execute_bigboot }}"
|
||||||
bigboot_size: "{{ bigboot_size }}"
|
# bigboot_execute_shrink_lv: "{{ bigboot_execute_shrink_lv }}"
|
||||||
bigboot_skip_rear_backup: "{{ bigboot_skip_rear | default('false') }}"
|
# bigboot_adjacent_lvm_device: "{{ bigboot_adjacent_lvm_device | trim }}"
|
||||||
per_host: false
|
# bigboot_lv_shrink_size: "{{ bigboot_lv_shrink_size | int }}"
|
||||||
aggregate: false
|
# bigboot_size: "{{ bigboot_size }}"
|
||||||
|
# bigboot_skip_rear_backup: "{{ bigboot_skip_rear | default('false') }}"
|
||||||
|
# per_host: false
|
||||||
|
# aggregate: false
|
||||||
|
|
||||||
...
|
...
|
||||||
|
31
tasks/cleanup.yml
Normal file
31
tasks/cleanup.yml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
- 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
|
||||||
|
|
||||||
|
...
|
Loading…
x
Reference in New Issue
Block a user