The problem
Ubuntu modern auto-installation is not a perfectly documented system. Some features also appear to be broken, so these examples rely on extensive use of user-data
passed directly into cloud-init
for things that are advertised to work as actual autoinstall
settings.
This page seeks to provide some filler to the gaps in documentation encountered when I started down the path of hands-off server provisioning into a traditional VMware vSphere environment on par with what is done for RHEL.
The main example also provides thorough example of a LVM deployment more common in the Enterprise Linux ecosystem than what is typically found on Ubuntu deployments.
For those coming from Enterprise Linux variants
Anaconda & Kickstart, as well as their documentation, are far more feature-complete, usable, and thorough than what you will find for Ubuntu. While you can technically use Kickstart for Ubuntu 18.04 LTS and Ubuntu 20.04 LTS, it’s obvious that Canonical wish to phase this out, and I wouldn’t count on the possibility in Ubuntu 22.04 LTS. For more information about legacy kickstart deployments of Ubuntu, please check out this handy GitHub repository: vrillusions/ubuntu-kickstart
For folks coming from the Enterprise Linux world, and new to Ubuntu Autoinstall and Cloud-Init, here are some quick hits:
-
Cloud-Init: A software system for passing OS customization to freshly instantiated systems. The goal is a standard configuration abstraction to configure system on any cloud, hypervisor, or bare metal. 3 YAML files are fed to cloud-init from a web server or metadata server depending on where your VM is being instantiated. The most important file is
user-data
, which is where your customizations will live. The other two files,vendor-data
andmeta-data
are used by cloud providers to pass along environment-specific data. -
Ubuntu Autoinstall : A further abstraction of Ubuntu-isms that complement Cloud-Init. Think of this as the Kickstart file.
-
Subiquity: The Ubuntu installer, Canonical’s equivalent of Anaconda. The docs aren’t stellar, so I’ve instead linked a good blog post covering the topic.
-
Curtin: The Ubuntu / Cloud-Init disk management and partitioning system.
Helpful feature: Much like Anaconda, Subiquity also provides an Autoinstall file after a manual installation, capturing all of the settings you interactively used, which can be used as a starting point in future deployments.
Instead of /root/anaconda-ks.cfg
, you’ll need to pluck this from /var/log/installer/autoinstall-user-data
.
Boot args to pull in Autoinstall file
Assuming that you’ve published your autoinstall user-data
file on a web server at http://kickstart-server.college.edu/autoinstall/
, you can use this kernel boot argument to ensure that Subiquity knows where to pull it from:
|
|
In Grub, use e
to edit, insert in the linux
line prior to the 3 hyphens, like so:
linux /casper/vmlinuz quiet autoinstall ds=nocloud-net\;s=http://kickstart-server.college.edu/autoinstall/ ---
Static IP deployments
Since Cloud-Init and Autoinstall are focused on “cloud” deployments, all documentation and examples seem to take for granted that you have a fully dynamic environment using DHCP and dynamic hostnames. Since neither of these are true or ideal for more traditional vSphere (“pets not cattle”) environments, I’ve focused on providing examples that expect static IPs and DNS hostnames. The key for static IP deployments is declaring the IP details on the kernel command line, which will be carried forward into the Autoinstall.
In Ubuntu 20.04 LTS, the kernel command line should look somewhat familiar to EL7+ kernel command line IP settings:
|
|
Above, we see these IP settings:
ip=[system static IP]::[system gateway IP]:[full netmask]:[system FQDN]:::[DNS server 1]:[DNS server 2]
Place these settings on the kernel command line in grub alongside the autoinstall kernel settings.
Further settings are optional but not necessary. See dracut.cmdline(7) for more details.
LVM layout
Given the complexity of Curtin disk partitioning customization, it’s best to start off with an example autoinstall file or to automatically generate one as described above, by interactively deploying a system and setting up partitions as you’d like them to be. The complete autoinstall file example below is a good starting point.
Password setting tip
On Ubuntu, ensure the whois
package is installed, which provides mkpasswd
. (On EL, the package is expect
…). Generate a salted SHA512 password hash interactively using mkpasswd
:
|
|
Example complete Autoinstall
|
|
Debugging
Subiquity failed autoinstaller logs live in /var/log/installer/subiquity-server-debug.log