use variables for vboxmanage and coreos OVA file

This commit is contained in:
Steven Polley 2023-12-22 19:54:11 -07:00
parent 7076c4ede5
commit 8fb03eb651

View File

@ -49,12 +49,18 @@ After you've checked the ignition files into version control, provision the serv
```bash
# Terraform? We roll our own.
# Stop git bash being stupid
export MSYS_NO_PATHCONV=1
# Be sure to run from 00-provisioning directory
cd 00-provisioning
# Set your own
VBOXMANAGE="C:/Program Files/Oracle/VirtualBox/vboxmanage"
COREOSAPPLIANCEIMAGE="D:/VirtualBox/OVA/fedora-coreos-39.20231119.3.0-virtualbox.x86_64.ova"
# Function to create VirtualBox VM, accepts name of VM as argument
create_vm() {
if [ -z "$1" ] || [ -z "$2" ]; then
@ -64,14 +70,12 @@ create_vm() {
return
fi
VBOX="C:/Program Files/Oracle/VirtualBox/vboxmanage.exe"
COREOSAPPLIANCEIMAGE="D:/VirtualBox/OVA/fedora-coreos-39.20231119.3.0-virtualbox.x86_64.ova"
"$VBOX" import --vsys 0 --vmname "$1" $COREOSAPPLIANCEIMAGE
"$VBOX" modifyvm $1 --nic1 bridged
"$VBOX" modifyvm $1 --bridge-adapter1 "Intel(R) Ethernet Controller I225-V"
"$VBOX" modifyvm $1 --macaddress1 $2
"$VBOX" guestproperty set $1 "/Ignition/Config" "$(cat ignition/$1-boot.json)"
"$VBOX" startvm $1 --type headless
"$VBOXMANAGE" import --vsys 0 --vmname "$1" $COREOSAPPLIANCEIMAGE
"$VBOXMANAGE" modifyvm $1 --nic1 bridged
"$VBOXMANAGE" modifyvm $1 --bridge-adapter1 "Intel(R) Ethernet Controller I225-V"
"$VBOXMANAGE" modifyvm $1 --macaddress1 $2
"$VBOXMANAGE" guestproperty set $1 "/Ignition/Config" "$(cat ignition/$1-boot.json)"
"$VBOXMANAGE" startvm $1 --type headless
}
# Controllers - if doing HA, need at least 3 for Raft concensus