Compare commits

..

No commits in common. "62b06f9c1be440ea699cd2d7ced9e4e056253f7f" and "7b3f0e5f0d1715d7f59be1b3f4de2824595945c7" have entirely different histories.

6 changed files with 68 additions and 107 deletions

View File

@ -124,10 +124,6 @@ build_pxe() {
cp templates/boot.pxe ${outputdir}/boot.pxe
echo "done."
echo -n "Copying preseed template... "
cp templates/host-preseed.j2 ${outputdir}/host-preseed.j2
echo "done."
sudo chown -R $(whoami) ${outputdir}
sudo chmod -R u+w ${outputdir}

View File

@ -59,6 +59,7 @@ panic()
# Reboot system
printf "System will reboot in 30 seconds. Press any key to spawn a shell instead.\n"
if ! read -t 30; then
sleep 30
reboot -f
fi

View File

@ -6,7 +6,7 @@ set kernel vmlinuz
set initrd initrd.img
# Set kernel command line parameters
set imgargs-base vga=normal nomodeset boot=live components ethdevice-timeout=300 timezone=America/Toronto fetch=${root-url}/filesystem.squashfs username=root
set imgargs-base vga=normal nomodeset boot=live components ethdevice-timeout=600 timezone=America/Toronto fetch=${root-url}/filesystem.squashfs username=root
set imgargs-pvcinstall pvcinstall.preseed=on pvcinstall.seed_host=${next-server} pvcinstall.seed_file=/host/mac-${mac:hexraw}.preseed
# Load per-host kernel command line parameters (should contain ${imgargs-host} if present)

View File

@ -1,63 +0,0 @@
# PVC install.sh preseed configuration Jinja2 template
#
# This BASH-compliant variables file is Loaded during PXE installs to preseed the environment.
# During normal usage, the pvcbootstrapd will load this file, adjust it according to its needs,
# and write out one instance per node to be installed.
#
# This file is thus not designed to be used by humans, and its values are seeded via options in
# the cluster-local Ansible group_vars, though it can be used as a manual template if required.
###
### General definitions/overrides
###
# The Debian release to use (overrides the default)
#debrelease="buster"
debrelease="{debrelease}"
# The Debian mirror to use (overrides the default)
#debmirror="http://debian.mirror.rafal.ca/debian"
debmirror="{debmirror}"
{% if addpkglist is defined and addpkglist %}
# Additional packages (comma-separated) to install in the base system
#addpkglist="mypackage,otherpackage"
addpkglist="{addpkglist}"
{% endif %}
{% if skip_blockcheck is defined and skip_blockcheck %}
# Skip block zeroing; only recommended for testing, slow, low-endurance, or known-zeroed block devices.
skip_blockcheck="y"
{% endif %}
###
### Per-host definitions (required)
###
# The hostname of the system (set per-run)
#target_hostname="myhostname.domain.tld"
target_hostname="{hostname}"
# The target system disk (either a path or model to find; path overrides model if set)
# Install will fail if these devices aren't found.
{% if target_disk_path is defined and target_disk_path %}
#target_disk_path="/dev/disk/by-path/pci-0000:03:00.0-scsi-0:1:0:0" # Example: RAID device via explicit path
target_disk_path="{target_disk_path}"
{% end if %}
{% if target_disk_model is defined and target_disk_model %}
#target_disk_model="DELLBOSS VD" # Example: Dell BOSS on R6515 via model name
target_disk_model="{target_disk_model}"
{% end if %}
# SSH key method (usually tftp)
target_keys_method="tftp"
# SSH key path (usually keys.txt)
target_keys_path="keys.txt"
# Deploy username (usually deploy)
target_deploy_user="deploy"
# Installer checkin URI (provided by pvcbootstrapd)
#pvcbootstrapd_checkin_uri="http://10.199.199.254:9999/checkin/installer"
pvcbootstrapd_checkin_uri="{pvcbootstrapd_checkin_uri}"

View File

@ -56,8 +56,8 @@ supported_debrelease="buster bullseye"
default_debrelease="buster"
default_debmirror="http://debian.mirror.rafal.ca/debian"
basepkglist="lvm2,parted,gdisk,grub-pc,grub-efi-amd64,linux-image-amd64,sudo,vim,gpg,gpg-agent,aptitude,openssh-server,vlan,ifenslave,python3,ca-certificates,curl"
suppkglist="firmware-linux,firmware-linux-nonfree,firmware-bnx2,firmware-bnx2x,ntp,ipmitool"
inclpkglist="lvm2,parted,gdisk,grub-pc,grub-efi-amd64,linux-image-amd64,sudo,vim,gpg,gpg-agent,aptitude,openssh-server,vlan,ifenslave,python3,ca-certificates,curl"
suppkglist="firmware-linux,firmware-linux-nonfree,firmware-bnx2,firmware-bnx2x,ntp"
# DANGER - THIS PASSWORD IS PUBLIC
# It should be used ONLY immediately after booting the PVC node in a SECURE environment
@ -66,6 +66,12 @@ suppkglist="firmware-linux,firmware-linux-nonfree,firmware-bnx2,firmware-bnx2x,n
# roles will overwrite it by default during configuration.
root_password="hCb1y2PF"
# Respawn function
respawn() (
echo "Respawning..."
$0 & disown
)
# Checkin function
seed_checkin() (
case ${1} in
@ -119,10 +125,6 @@ seed_config() {
. /tmp/install.seed || exit 1
if [[ -n "${addpkglist}" ]]; then
suppkglist="${suppkglist},${addpkglist}"
fi
# Handle the target interface
target_route="$( ip route show to match ${seed_host} | grep 'scope link' )"
target_interface="$( grep -E -o 'e[a-z]+[0-9]+[a-z0-9]*' <<<"${target_route}" )"
@ -187,7 +189,7 @@ interactive_config() {
done
)"
echo "2a) Please enter the disk to install the PVC base system to. This disk will be"
echo "2) Please enter the disk to install the PVC base system to. This disk will be"
echo "wiped, an LVM PV created on it, and the system installed to this LVM."
echo "* NOTE: PVC requires a disk of at least 30GB to be installed to, and 100GB is the"
echo "recommended minimum size for optimal production partition sizes."
@ -218,16 +220,6 @@ interactive_config() {
echo
done
echo "2b) Skip disk zeroing? Only recommended for slow, low-endurance, or known-"
echo -n "zeroed block devices. [y/N] "
read skip_blockcheck
if [[ ${skip_blockcheck} == 'y' || ${skip_blockcheck} == 'Y' ]]; then
skip_blockcheck="y"
else
skip_blockcheck=""
fi
echo
for interface in $( ip address | grep '^[0-9]' | grep 'eno\|enp\|ens\|wlp' | awk '{ print $2 }' | tr -d ':' ); do
ip link set ${interface} up
done
@ -497,19 +489,15 @@ cleanup() {
echo "done."
echo
if [[ -n ${DONE} ]]; then
case ${install_option} in
on)
echo "A fatal error occurred; rebooting in 10 seconds."
sleep 10
reboot
;;
*)
# noop
true
;;
esac
fi
case ${install_option} in
on)
respawn
;;
*)
# noop
true
;;
esac
}
trap cleanup EXIT
@ -537,8 +525,8 @@ vgchange -an >&2 || true
echo "done."
blockcheck() {
# Skip checking if the key is set
if [[ -n ${skip_blockcheck} ]]; then
# Use for testing only
if [[ -n ${SKIP_BLOCKCHECK} ]]; then
return
fi
@ -643,8 +631,8 @@ mount -t tmpfs tmpfs ${target}/tmp >&2
echo "done."
echo -n "Running debootstrap install... "
echo "Command: debootstrap --include=${basepkglist} ${debrelease} ${target}/ ${debmirror}" >&2
debootstrap --include=${basepkglist} ${debrelease} ${target}/ ${debmirror} >&2
echo "Command: debootstrap --include=${inclpkglist} ${debrelease} ${target}/ ${debmirror}" >&2
debootstrap --include=${inclpkglist} ${debrelease} ${target}/ ${debmirror} >&2
echo "done."
echo -n "Adding non-free repository (firmware, etc.)... "
@ -836,7 +824,7 @@ cat <<EOF | tee ${target}/etc/default/grub >&2
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Parallel Virtual Cluster (PVC) - Debian"
GRUB_CMDLINE_LINUX="console=hvc0 console=tty0 console=tty1 console=ttyS0,115200 console=ttyS1,115200"
GRUB_CMDLINE_LINUX="console=hvc0 console=tty0 console=ttyS0,115200"
GRUB_TERMINAL_INPUT="console serial"
GRUB_TERMINAL_OUTPUT="gfxterm serial"
GRUB_SERIAL_COMMAND="serial --unit=0 --unit=1 --speed=115200"
@ -845,15 +833,19 @@ chroot ${target} grub-install --force --target=${bios_target} ${target_disk} >&2
chroot ${target} grub-mkconfig -o /boot/grub/grub.cfg >&2
echo "done."
DONE="y"
seed_postinst() {
cleanup
echo "Temporary root password: ${root_password}"
seed_checkin end
echo "Rebooting in 10 seconds."
sleep 10
echo -n "Rebooting in 10 seconds..."
i=10
while [[ ${i} -gt 0 ]]; do
sleep 1
i=$(( ${1} - 1 ))
echo -n "."
done
echo
reboot
}

View File

@ -0,0 +1,35 @@
###
### General definitions
###
# The Debian release to use
debrelease="bullseye"
# The Debian mirror to use
debmirror="http://debian.mirror.rafal.ca/debian"
# Package list (installed during debootstrap)
debpkglist="lvm2,parted,gdisk,grub-pc,grub-efi-amd64,linux-image-amd64,sudo,vim,gpg,gpg-agent,aptitude,openssh-server,vlan,ifenslave,python2,python3,ca-certificates,ntp"
# Package list (installed in chroot)
suppkglist="firmware-linux,firmware-linux-nonfree,firmware-bnx2,firmware-bnx2x"
###
### Per-host definitions
###
# The hostname of the system (set per-run)
target_hostname="HOSTNAME"
# The target disk (either path or model to find; path overrides model if set)
target_disk_path="/dev/disk/by-path/pci-0000:01:00.0-scsi-0:2:0:0" # Example: Dell BOSS on R6515 via explicit path
target_disk_model="DELLBOSS VD" # Example: Dell BOSS on R6515 via model name
# SSH key method (usually tftp)
target_keys_method="tftp"
# SSH key path
target_keys_path="keys.txt"
# Deploy username
target_deploy_user="deploy"