zuul-jobs/test-playbooks/diskimage-builder/convert-diskimage.yaml
Simon Westphahl 5c10b708f0 Add a role to convert diskimages between formats
This adds a role convert-diskimage which uses the qemu-img tool to
convert diskimages from one format to another. Currently supported image
formats are raw and qcow2.

Change-Id: I4770af04c37f39e0cce23d5dd59ead744bed7d74
2024-08-27 08:59:53 -07:00

22 lines
728 B
YAML

- hosts: all
roles:
- ensure-dib
- role: build-diskimage
build_diskimage_image_name: foo-ubuntu-image
build_diskimage_formats: ["raw"]
build_diskimage_elements: ["vm", "ubuntu"]
environment:
DIB_RELEASE: "noble"
- role: convert-diskimage
convert_diskimage_source_image: "/home/zuul/dib-images/foo-ubuntu-image.raw"
convert_diskimage_target_image: "/home/zuul/dib-images/foo-ubuntu-image"
convert_diskimage_target_formats: ["qcow2"]
tasks:
- name: Gather image file info
stat:
path: "/home/zuul/dib-images/foo-ubuntu-image.qcow2"
register: image_file
- name: Assert image file exists
assert:
that: image_file.stat.exists