I’ve been using packer to build my Ubuntu LTS VMs for a long time and finally with the release of the latest Ubuntu LTS version 22.04 I got enough motivation to bring the project in sync with my learnings from the Windows Server 2022 build I wrote about before.
This project can both build Ubuntu LTS 20.04 and 22.04. It runs an unattended installation from the ISO on a vSphere environment (
vsphere-iso builder) and extracts the contents in an OVF/OVA format.
The build is made for lab purposes and the resulting OVAs should not be used for production systems unless you know how to harden them properly.
Before even thinking about using this project be aware of the following requirements:
- I am using the vsphere-iso builder. This requires a VMware vCenter from version 6.5 and that means a vSphere license.
- I am using a local installation of Gitlab-CE and Gitlab-CI for my build automation. If you want to build automated you can do the same but manual builds from the CLI are possible. In my config I run Pipelines only when started manually from the Web UI and not on every commit.
- Of course you’ll need Hashicorp’s packer
Get the code
I published the code on both GitHub and GitLab. I am running this on my own lab in GitLab using Gitlab-CI for automated builds. For now I don’t see a possibility for public builds because of licensing restrictions (VMware).
One important thing though is that this project is capable of building to OVAs. One for Ubuntu LTS 20.04 and one for LTS 22.04. Depending on which one you want as an output you have to specify the correct var file in your build:
packer build -var-file="ubuntults2204.pkrvars.hcl" .
I hope this is useful for someone.