fix(bootstrap): add pre-block safety flag to prevent deleting pre-existing VMs
This commit is contained in:
5
main.yml
5
main.yml
@@ -113,6 +113,10 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Bootstrap pipeline
|
- name: Bootstrap pipeline
|
||||||
block:
|
block:
|
||||||
|
- name: Record that no pre-existing VM was found
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
_vm_absent_before_bootstrap: true
|
||||||
|
|
||||||
- name: Create virtual machine
|
- name: Create virtual machine
|
||||||
when: system_cfg.type == "virtual"
|
when: system_cfg.type == "virtual"
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
@@ -157,6 +161,7 @@
|
|||||||
rescue:
|
rescue:
|
||||||
- name: Delete VM on bootstrap failure
|
- name: Delete VM on bootstrap failure
|
||||||
when:
|
when:
|
||||||
|
- _vm_absent_before_bootstrap | default(false) | bool
|
||||||
- virtualization_vm_created_in_run | default(false) | bool
|
- virtualization_vm_created_in_run | default(false) | bool
|
||||||
- system_cfg.type == "virtual"
|
- system_cfg.type == "virtual"
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
|
|||||||
Reference in New Issue
Block a user