Skip to content

Instantly share code, notes, and snippets.

@flokli
Created March 25, 2022 16:31
Show Gist options
  • Save flokli/24f23751aa7fd0459fca82fd61fbc12e to your computer and use it in GitHub Desktop.
Save flokli/24f23751aa7fd0459fca82fd61fbc12e to your computer and use it in GitHub Desktop.
Install talos nocloud and add CIDATA with config
#!/usr/bin/env bash
# This assumes a booted rescue system, copies the installation media to the destination disk
# it'll then add a CIDATA partition to the end of the disk, and prepare it with user-data
# used in a terraform ssh provisioner, but extracted to here for now.
destination_disk=/dev/nvme0n1
talos_version=v0.14.3
wipefs -af $destination_disk
wget https://github.com/talos-systems/talos/releases/download/${talos_version}/nocloud-amd64.raw.xz
xzcat nocloud-amd64_.raw.xz | dd of=${destination_disk} bs=1M
sgdisk --move-second-header ${destination_disk}
# create new CIDATA partition at the end of the disk
sgdisk --new 0:-100M:0 --typecode 0:8300 ${destination_disk} --change-name=0:'CIDATA' ${destination_disk}
apt install -y genisoimage
# write config as user-data
echo CONFIG_GOES_HERE > user-data
# assemble a ISO
genisoimage -output cidata.iso -V cidata -r -J user-data
# write to partition
dd if=cidata.iso of=/dev/disk/by-partlabel/CIDATA bs=1M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment