Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
vultr-preseed-raid-o
# Localization
d-i debian-installer/locale string en_AU
# 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 us.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 Australia/Perth
# 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/sda /dev/sdb
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 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgyZxbGNzYsx4yrXjAAljnR2gYIsQQZejQ2CZA2efppo3He7rd8tlbf8fQZoez+DYx0oO0P6Tt5uH5d3318ijQTtjfyt/eXPBLeHB+hn6n+K492A9iIeu66dnxEbqbCt9JBg+w/OMX2xwwHUwi5Z3Y1Ltcik29y4YKFGAB2EwPHwR2r1QJCL2T0/J1sLMkyMKj8vaxpedMtZpez2ozVnP845TBdZSgaIC6HY/eVukpYVrdE8J7rkSftTiOkhRq2Bo3vZ494SonTucUk4YQamjiaQ3vXWWUP/9vdFusRgGqrR+fTjgHDSppv7u9fUUBGHPpO90E9dc0pY+OdGyy99xb" >> /target/root/.ssh/authorized_keys;
#install grub
d-i grub-installer/only_debian boolean false
d-i grub-installer/bootdev string /dev/sda /dev/sdb
# 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