Files
resf-testing-repo/ansible/roles/golden_image/tasks/main.yml
Stephen Simpson ec04f0bec5 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>
2025-12-29 16:02:39 -06:00

36 lines
1.0 KiB
YAML

---
- name: Verify base image exists
ansible.builtin.stat:
path: "{{ golden_image_base_image_path }}"
register: golden_image_base_image_stat
failed_when: not golden_image_base_image_stat.stat.exists
- name: Ensure golden image directory exists
ansible.builtin.file:
path: "{{ golden_image_path | dirname }}"
state: directory
mode: '0755'
become: true
- name: Copy base image to golden image
ansible.builtin.copy:
src: "{{ golden_image_base_image_path }}"
dest: "{{ golden_image_path }}"
remote_src: true
mode: '0644'
become: true
- name: Customize golden image
ansible.builtin.command: >
virt-customize -a {{ golden_image_path }}
--install perl,git,wget,tar,openssh-server,vim
--run {{ role_path }}/tasks/customize.sh
--ssh-inject root:file:{{ ssh_public_key_path }}
--ssh-inject rocky:file:{{ ssh_public_key_path }}
--root-password password:{{ root_password }}
--selinux-relabel
changed_when: false
environment:
LIBGUESTFS_BACKEND: direct
become: true