Implement Ansible roles for Rocky Linux Testing Framework
- Added `bootstrap_sparrowdo` role for bootstrapping Sparrowdo on a VM. - Introduced `cleanup_vm` role for cleaning up VMs and disk images. - Created `download_image` role to download and cache QCOW2 images. - Developed `golden_image` role for creating and customizing golden images. - Implemented `provision_vm` role for provisioning VMs as linked clones. - Added `run_test` role for executing tests with Sparrowdo. - Created playbooks for building golden images, running single tests, and running test suites. - Enhanced documentation with usage examples, configuration details, and troubleshooting tips. - Added support for multiple cloud providers (AWS, Azure) in the test execution workflow. Signed-off-by: Stephen Simpson <ssimpson89@users.noreply.github.com>
This commit is contained in:
23
ansible/roles/cleanup_vm/tasks/cleanup_single.yml
Normal file
23
ansible/roles/cleanup_vm/tasks/cleanup_single.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
# Cleanup a single VM (used in loop)
|
||||
|
||||
- name: Destroy VM {{ vm_to_cleanup }}
|
||||
command: virsh -c qemu:///system destroy {{ vm_to_cleanup }}
|
||||
become: true
|
||||
register: destroy_result
|
||||
failed_when: false
|
||||
changed_when: destroy_result.rc == 0
|
||||
|
||||
- name: Undefine VM {{ vm_to_cleanup }}
|
||||
command: virsh -c qemu:///system undefine {{ vm_to_cleanup }}
|
||||
become: true
|
||||
register: undefine_result
|
||||
failed_when: false
|
||||
changed_when: undefine_result.rc == 0
|
||||
|
||||
- name: Remove disk for VM {{ vm_to_cleanup }}
|
||||
file:
|
||||
path: "/var/lib/libvirt/images/{{ vm_to_cleanup }}.qcow2"
|
||||
state: absent
|
||||
become: true
|
||||
when: remove_disk
|
||||
Reference in New Issue
Block a user