As promised, here the actions I have made in orde to autoinstall ubuntu-server 20.04.3 from the live-iso.
I used following references:
How I applied it in our environment:
- make iso available in Foreman
mkdir -p /var/www/html/pub/installation_media/ISO
- mount the iso to /mnt in order to copy necessary files needed for correct PXE-booting:
mount ubuntu-20.04.3-live-server-amd64.iso /mnt/ mkdir -p /var/lib/tftpboot/ubuntu/focal cd /var/lib/tftpboot/ubuntu/focal cp cp /mnt/casper/vmlinuz . cp /mnt/casper/initrd . chmod 644 * umount /mnt
- created a new partition table template using the cloud-init format.
- created the following new templates:
- preseed pxelinux using the correct config for cloud-init autoinstall.
- provisioning template using the new cloud-init format.
- snippet preseed_netplan_setup in order to configure the network config configured for the host (bonds, bridges, vlans, and normal interfaces, which is used in the new provisioning template
- snippet preseed_netplan_generic_interface that configures the ipv4 and ipv6 for each interface if configured, wich is used by the snippet preseed_netplan_setup.
- create a new location where the necessary cloud-init files meta-data and user-data should be provided.
The user-data is the combination of new provisioning template and the new partition table.
See below manual actions I have done.
- create new installtion media “Ubuntu 20 ISO” in Foreman with path “http://< foreman server >/pub/installation_media/ISO/ubuntu-20.04.3-live-server-amd64.iso” and Family “Debian”.
And of course linked to the necessary location(s) and organization(s).
- Creating Operating System “Ubuntu 20.04” pointing to the new installation media and linking the new partioning table and template(s).
When applying build server in Foreman the new PXElinux template generates a new file in /var/lib/tftpboot/pxelinux.cfg with following content:
DEFAULT linux autoinstall LABEL linux autoinstall KERNEL ubuntu/focal/vmlinuz INITRD ubuntu/focal/initrd APPEND ip=dhcp url=http://< foreman server >/pub/installation_media/ISO/ubuntu-20.04.3-live-server-amd64.iso autoinstall ds=nocloud-net;s=http://< foreman server >/pub/preseed/autoinstall/< hostname.short >/ root=/dev/ram0 ramdisk_size=1500000 fsck.mode=skip
Bacause Foreman, correct me if I’m wrong, can not generate the new files meta-data and user-data in /pub/preseed/autoinstall/< hostname.short > I created them manually:
- mkdir /var/www/html/pub/preseed/autoinstall/< hostname.short >/
- cd /var/www/html/pub/preseed/autoinstall/< hostname.short >/
- create meta-data file which may contain always the same like:
cat > meta-data <<EOF instance-id: focal-autoinstall EOF
- create the user-data file which contains the cloud-init autoinstall configuration.
As described above it will contain the content of the new provisioning template with content of the snippet netplan_setup and the config of partitioning table.
In order to have the content I did a preview of the new provisioning template linked to the host.
- these 2 files should have permission 644.
With this setup I was able to provision my test-host Ubuntu 20.04.3
I know this doesn’t cover al possible methods of net-booting, but might be a good start.
Anyway, I hope that this can be a base for someone in order to make the necessary changes in the Foreman/Katello.
Please let me know where I can make the new templates available, and of course let me know if additional info is required.
As said in my previous post, this is not yep 100% complete, I still need to find out how to configure the following in the cloud-init file:
- install/config puppet on the host
- applying the subscription in foreman which configures the apt repo pointing to the repo’s configured the activation key
If someone is able to apply this before me, I would appreciate it to share this as well.