Install UBUNTU 22.04 offline with PACKER and CLOUD-INIT

What’s the trick?! Why it is so hard to install god damn UBUNTU 22.04 with PACKER in your offline lab? With no internet? In the dark … well. Here’s the trick 🙂

In your user-data.pktrpl.hcl file, you just need to specify that no repository is available and cloud-config will happily go through with the installation.

#cloud-config

autoinstall:
  version: 1
  apt:
    disable_suites: [updates, backports, security, proposed, release, inversion, multiverse]

a cloud-config file should always start with #cloud-config or else you’ll waste many hours figuring out why you are ending up in the initial UBUNTU configuration menu.

version: 1 is the version of cloud-config it’s using

apt is … well the aptitude block for your updates.

and finally, the missing piece of the puzzle. disable_suites will disable ALL UBUNTU repositories and updates.

Enjoy!