Compare commits
	
		
			6 Commits
		
	
	
		
			7b3f0e5f0d
			...
			62b06f9c1b
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 62b06f9c1b | |||
| 483068c38c | |||
| dcc608d090 | |||
| 5924a78edc | |||
| 03a01d563c | |||
| d9c527d72c | 
| @@ -124,6 +124,10 @@ 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} | ||||
|  | ||||
|   | ||||
| @@ -59,7 +59,6 @@ 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 | ||||
|  | ||||
|   | ||||
| @@ -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=600 timezone=America/Toronto fetch=${root-url}/filesystem.squashfs username=root | ||||
| set imgargs-base vga=normal nomodeset boot=live components ethdevice-timeout=300 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) | ||||
|   | ||||
							
								
								
									
										63
									
								
								templates/host-preseed.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								templates/host-preseed.j2
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | ||||
| # 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}" | ||||
| @@ -56,8 +56,8 @@ supported_debrelease="buster bullseye" | ||||
| default_debrelease="buster" | ||||
| default_debmirror="http://debian.mirror.rafal.ca/debian" | ||||
|  | ||||
| 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" | ||||
| 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" | ||||
|  | ||||
| # DANGER - THIS PASSWORD IS PUBLIC | ||||
| # It should be used ONLY immediately after booting the PVC node in a SECURE environment | ||||
| @@ -66,12 +66,6 @@ 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 | ||||
| @@ -125,6 +119,10 @@ 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}" )" | ||||
| @@ -189,7 +187,7 @@ interactive_config() { | ||||
|         done | ||||
|     )" | ||||
|  | ||||
|     echo "2) Please enter the disk to install the PVC base system to. This disk will be" | ||||
|     echo "2a) 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." | ||||
| @@ -220,6 +218,16 @@ 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 | ||||
| @@ -489,15 +497,19 @@ cleanup() { | ||||
|     echo "done." | ||||
|     echo | ||||
|  | ||||
|     if [[ -n ${DONE} ]]; then | ||||
|         case ${install_option} in | ||||
|             on) | ||||
|             respawn | ||||
|                 echo "A fatal error occurred; rebooting in 10 seconds." | ||||
|                 sleep 10 | ||||
|                 reboot | ||||
|             ;; | ||||
|             *) | ||||
|                 # noop | ||||
|                 true | ||||
|             ;; | ||||
|         esac | ||||
|     fi | ||||
| } | ||||
| trap cleanup EXIT | ||||
|  | ||||
| @@ -525,8 +537,8 @@ vgchange -an >&2 || true | ||||
| echo "done." | ||||
|  | ||||
| blockcheck() { | ||||
|     # Use for testing only | ||||
|     if [[ -n ${SKIP_BLOCKCHECK} ]]; then | ||||
|     # Skip checking if the key is set | ||||
|     if [[ -n ${skip_blockcheck} ]]; then | ||||
|         return | ||||
|     fi | ||||
|  | ||||
| @@ -631,8 +643,8 @@ mount -t tmpfs tmpfs ${target}/tmp >&2 | ||||
| echo "done." | ||||
|  | ||||
| echo -n "Running debootstrap install... " | ||||
| echo "Command: debootstrap --include=${inclpkglist} ${debrelease} ${target}/ ${debmirror}" >&2 | ||||
| debootstrap --include=${inclpkglist} ${debrelease} ${target}/ ${debmirror} >&2 | ||||
| echo "Command: debootstrap --include=${basepkglist} ${debrelease} ${target}/ ${debmirror}" >&2 | ||||
| debootstrap --include=${basepkglist} ${debrelease} ${target}/ ${debmirror} >&2 | ||||
| echo "done." | ||||
|  | ||||
| echo -n "Adding non-free repository (firmware, etc.)... " | ||||
| @@ -824,7 +836,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=ttyS0,115200" | ||||
| GRUB_CMDLINE_LINUX="console=hvc0 console=tty0 console=tty1 console=ttyS0,115200 console=ttyS1,115200" | ||||
| GRUB_TERMINAL_INPUT="console serial" | ||||
| GRUB_TERMINAL_OUTPUT="gfxterm serial" | ||||
| GRUB_SERIAL_COMMAND="serial --unit=0 --unit=1 --speed=115200" | ||||
| @@ -833,19 +845,15 @@ 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 -n "Rebooting in 10 seconds..." | ||||
|     i=10 | ||||
|     while [[ ${i} -gt 0 ]]; do | ||||
|         sleep 1 | ||||
|         i=$(( ${1} - 1 )) | ||||
|         echo -n "." | ||||
|     done | ||||
|     echo | ||||
|     echo "Rebooting in 10 seconds." | ||||
|     sleep 10 | ||||
|     reboot | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,35 +0,0 @@ | ||||
| ### | ||||
| ### 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" | ||||
		Reference in New Issue
	
	Block a user