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