by voidfunc · 5y ago · 0 comments
Terraform is dog slow sometimes due to cloud provisioning. Would be nice to just be able to build the VM locally then push the AMI/VHD into AWS or Azure.
$ virt-builder fedora-33
[ 1.5] Downloading: http://builder.libguestfs.org/fedora-33.xz
[ 2.3] Planning how to build this image
[ 2.3] Uncompressing
[ 8.6] Opening the new disk
[ 13.8] Setting a random seed
[ 13.8] Setting passwords
virt-builder: Setting random password of root to mZbPJw9d1ZHgowBk
[ 14.8] Finishing off
Output file: fedora-33.img
Output size: 6.0G
Output format: raw
Total usable space: 6.0G
Free space: 4.7G (79%)
By the way, interesting virt-builder factoid: It uses a STRIPS-based planner to optimize the order of steps when building the image, so it doesn't waste time doing multiple copies.
https://en.wikipedia.org/wiki/Stanford_Research_Institute_Pr...
https://github.com/rwmjones/guestfs-tools/blob/0cffcbb7848af...
https://github.com/libguestfs/libguestfs-common/blob/74bc5c5...
https://github.com/libguestfs/libguestfs-common/blob/74bc5c5... $ virt-builder fedora-32 --size 10G --format qcow2
Then the (xz-compressed) template Fedora 32 image will be cached under ~/.cache/virt-builder. So your subsequent Fedora 32 image provisioning will be much faster.You might want to give it a whirl and see if it satisfies your needs; `virt-builder` should be available on most major Linux distributions.