I had a need in my home lab to quickly deploy a bunch of thin clones of Ubuntu’s cloud image. I chose to use the cloud images Ubuntu provides instead of building a custom template.
Xen Orchestra has had support for cloud-init since 2015.
Here is the short version of how this works:
- Download the current 20.04 ubuntu cloud image OVA file, there should only be 1 on each build’s page. I used focal-server-cloudimg-amd64.ova
- In Xen Orchestra, Import -> VM, then drag & drop your ova onto the obvious place. Set the default CPU, Memory, and target VM Network settings & click Import
- When it’s finished, you can click on Home -> VMs, and clear the “power_state:running” filter from the display.
- Select the powered-off vm, and rename it whatever you want.
- On the Advanced tab, click “Convert to template”
- Click the “New VM” button in the top-right corner
- Choose a pool
- Select your newly-created template from the list
- Adjust CPU, Ram, etc as necessary.
- Under the “Install settings” header, choose a custom config
- Paste your customized User and Network config
- Click “Create”
Example cloud-init configs:
I don’t know if this is unique to Xen Orchestra or not, but the syntax of the network config is a little odd. No matter what else you change, leave the first line EXACTLY as you see it below.
This approach is fast, but doesn’t properly install the xcp-ng guest tools. You’ll probably want those if you want XCP-NG or Xen-Orchestra to be able to dive into each guest VM and display a useful level of detail about the guest. You can do a normal install from an iso, install some packages and run “cloud-init clean”, then immediately shut down the VM. This will force cloud init to run the same way it would if this were a fresh machine - generating host keys, naming the machine and applying any other config you pass in.
Aaron Glenn Admin/Mentor
Aaron is a Sr. Systems Administrator from Tulsa, specializing in Microsoft technologies, with an emphasis on powershell.