Skip to content

Instantly share code, notes, and snippets.

@lostsnow
Last active December 7, 2023 15:15
Show Gist options
  • Save lostsnow/3107fd308eaef21f05ea1dd6185d25e0 to your computer and use it in GitHub Desktop.
Save lostsnow/3107fd308eaef21f05ea1dd6185d25e0 to your computer and use it in GitHub Desktop.
# Localization
d-i debian-installer/locale string en_US
# Keyboard
# Disable interactive keymap detection.
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
# Network
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname notusedanyway
# Repository mirror
d-i mirror/country string manual
d-i mirror/http/hostname string archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string
# Skip creation of a regular user, set up only root with no password. The access will be performed by SSH key specified in the end.
d-i passwd/root-login boolean true
d-i passwd/make-user boolean false
d-i passwd/root-password-crypted password !NO-PASSWD
# Server timezone
d-i time/zone string UTC
# Whether system clock set to UTC
d-i clock-setup/utc boolean false
# NTP settings
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string ntp.ubuntu.com
#Partitioning
#remove all existing LVM and RAID setups
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm boolean true
d-i partman/choose_partition select finish
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-md/confirm boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/confirm boolean true
#define that we need RAID
d-i partman-auto/method string raid
d-i partman-auto/disk string /dev/nvme0 /dev/nvme1
d-i partman-auto-raid/recipe string \
0 2 0 ext4 / raidid=1 .
d-i partman-auto/expert_recipe string \
multiraid :: \
500 10000 -1 raid \
$primary{ } \
$lvmignore{ } \
method{ raid } \
raidid{ 1 } \
.
#RAID is degraded until automatic sync, so it's fine
d-i mdadm/boot_degraded boolean true
# finish partitioning without confirmation
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
#software installation
d-i apt-setup/use_mirror boolean true
#install standard tools
#tasksel tasksel/first standard
#install ssh-server
d-i pkgsel/include string openssh-server
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# add an authorized SSH key and add the protection flag, so the startup script won't run again
# looks lame, but nicer approaches didn't work for me
d-i preseed/late_command string echo "Installed and partitioned by the iPXE startup script. Do not delete this file or the system may be wiped upon reboot." > /target/etc/ipxe-preseed.flag; \
mkdir -p /target/root/.ssh; chmod 700 /target/root/.ssh; touch /target/root/.ssh/authorized_keys; chmod 600 /target/root/.ssh/authorized_keys; \
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3BTu2zxvcbcbekzADwmzlMSiIkxIhO3h8822B7bBC+276OFNMttWUuMa8ob4aL2bqZ0BuAdEab7nkMtgs/fupQl8VT+sz80zVEj9/m30zc5N/+qYeoKgjZUz6TUvu0r9Ch+7EY5jmkZUavDeOg4/ePln+iAu0FLZJm69ZMY4TLIV30KfUm+2M70HAxdAqTMLDye1v0JgYYPBPRd9OzdPp7czmCtWzW+TrHbxIUG04QjG5lmrypzQx5umFp/qB1CKE+RBtpp0XluG3X0cuxlbWoMS7k7NzAHOCzlT77+e7ZpR2dlNS4jSi6Gk2ZQqAJKQMOoQ/CDid4sICIzhyqmJtjKCbrFD4645qGkv2lBk5v9z6r/hZDQvmFnlpfKnG81SqoxgQSn0PxqhH4ZAFexAVPDBXDx69BLRBTSCAbsePVP2HH7E+IGHqH+s64Ym8vOqsDc2dafJynmWnsYrFrZk3H2YDZGhavGsAE0B7EbtcoCEO1UikR0e8ZFy0f5bGv4azR9zgwTJmb/trNAwq0gwAxH/bBb7/AFUzKFm2LAxn0ZZmJG7AFfZ5KyGxB8r33arP2LdW7eM39GMjN9ac4FLG/qokBY6bc7U0GoMKIKk4Wn6Ry/HhTmYP+BDn8NkTrthn5g33ScyslMsrIcb+ofwbFD28mfrh/2uLa7TaEHQYSQ== eth-prod" >> /target/root/.ssh/authorized_keys;
#install grub
d-i grub-installer/only_debian boolean false
d-i grub-installer/bootdev string /dev/nvme0 /dev/nvme1
# finish the install and reboot
d-i finish-install/reboot_in_progress note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment