refactor(cleanup): add configurable verify_boot, boot_timeout, and remove_on_failure defaults
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
---
|
||||
# Post-reboot verification
|
||||
cleanup_verify_boot: true
|
||||
cleanup_boot_timeout: 300
|
||||
cleanup_remove_on_failure: true
|
||||
|
||||
# Libvirt paths
|
||||
cleanup_libvirt_image_dir: >-
|
||||
{{
|
||||
system_cfg.path
|
||||
|
||||
@@ -28,19 +28,21 @@
|
||||
|
||||
- name: Check VM accessibility after reboot
|
||||
when:
|
||||
- cleanup_verify_boot | bool
|
||||
- system_cfg.type == "virtual"
|
||||
- cleanup_post_reboot_can_connect | bool
|
||||
block:
|
||||
- name: Attempt to connect to VM
|
||||
delegate_to: "{{ inventory_hostname }}"
|
||||
ansible.builtin.wait_for_connection:
|
||||
timeout: 300
|
||||
timeout: "{{ cleanup_boot_timeout }}"
|
||||
register: cleanup_vm_connection_check
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: VM failed to boot - initiate cleanup
|
||||
when:
|
||||
- cleanup_remove_on_failure | bool
|
||||
- cleanup_vm_connection_check is defined
|
||||
- cleanup_vm_connection_check.failed | bool
|
||||
- virtualization_vm_created_in_run | default(false) | bool
|
||||
|
||||
Reference in New Issue
Block a user