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: >-
|
cleanup_libvirt_image_dir: >-
|
||||||
{{
|
{{
|
||||||
system_cfg.path
|
system_cfg.path
|
||||||
|
|||||||
@@ -28,19 +28,21 @@
|
|||||||
|
|
||||||
- name: Check VM accessibility after reboot
|
- name: Check VM accessibility after reboot
|
||||||
when:
|
when:
|
||||||
|
- cleanup_verify_boot | bool
|
||||||
- system_cfg.type == "virtual"
|
- system_cfg.type == "virtual"
|
||||||
- cleanup_post_reboot_can_connect | bool
|
- cleanup_post_reboot_can_connect | bool
|
||||||
block:
|
block:
|
||||||
- name: Attempt to connect to VM
|
- name: Attempt to connect to VM
|
||||||
delegate_to: "{{ inventory_hostname }}"
|
delegate_to: "{{ inventory_hostname }}"
|
||||||
ansible.builtin.wait_for_connection:
|
ansible.builtin.wait_for_connection:
|
||||||
timeout: 300
|
timeout: "{{ cleanup_boot_timeout }}"
|
||||||
register: cleanup_vm_connection_check
|
register: cleanup_vm_connection_check
|
||||||
failed_when: false
|
failed_when: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: VM failed to boot - initiate cleanup
|
- name: VM failed to boot - initiate cleanup
|
||||||
when:
|
when:
|
||||||
|
- cleanup_remove_on_failure | bool
|
||||||
- cleanup_vm_connection_check is defined
|
- cleanup_vm_connection_check is defined
|
||||||
- cleanup_vm_connection_check.failed | bool
|
- cleanup_vm_connection_check.failed | bool
|
||||||
- virtualization_vm_created_in_run | default(false) | bool
|
- virtualization_vm_created_in_run | default(false) | bool
|
||||||
|
|||||||
Reference in New Issue
Block a user