I’m investigating the creation of VM images for different virtualisation solutions.
Among the target platforms is a destop as a service platform based on an OpenStack public cloud.
We’ve been working with bootstrap-vz for creating VMs for Vagrant+VirtualBox so I wanted to test its use for OpenStack.
There are already pre-made images available, including official Debian ones, but I like to be able to re-create things instead of depending on some external magic (which also means to be able to optimize, customize and avoid potential MitM, of course).
It appears that bootstrap-vz can be used with cloud-init provided that some bits of config are specified.
In particular the cloud_init plugin of bootstrap-vz requires a metadata_source
set to “NoCloud, ConfigDrive, OpenStack, Ec2
“. Note we explicitely spell it ‘OpenStack
‘ and not ‘Openstack
‘ as was mistakenly done in the default Debian cloud images (see https://bugs.debian.org/854482).
The following snippet of manifest provides the necessary bits :
--- name: debian-{system.release}-{system.architecture}-{%Y}{%m}{%d} provider: name: kvm virtio_modules: - virtio_pci - virtio_blk bootstrapper: workspace: /target # create or reuse a tarball of packages tarball: true system: release: jessie architecture: amd64 bootloader: grub charmap: UTF-8 locale: en_US timezone: UTC volume: backing: raw partitions: #type: gpt type: msdos root: filesystem: ext4 size: 4GiB swap: size: 512MiB packages: # change if another mirror is closer mirror: http://ftp.fr.debian.org/debian/ plugins: root_password: password: whatever cloud_init: username: debian # Note we explicitely spell it 'OpenStack' and not 'Openstack' as done in the default Debian cloud images (see https://bugs.debian.org/854482) metadata_sources: NoCloud, ConfigDrive, OpenStack, Ec2 # admin_user: # username: Administrator # password: Whatever minimize_size: # reduce the size by around 250 Mb zerofree: true
I’ve tested this with the bootstrap-vz version in stretch/testing (0.9.10+20170110git-1) for creating jessie/stable image, which were booted on the OVH OpenStack public cloud. YMMV.
Hope this helps