createvm
Code: Select all
VBoxManage createvm --name node-01 --register --basefolder /home/user/.terraform/virtualbox/machine
Virtual machine 'node-01' is created and registered.
UUID: 7140d136-0aff-40a2-9cb4-ae5385b4f46a
Settings file: '/home/user/.terraform/virtualbox/machine/node-01/node-01.vbox'
Code: Select all
VBoxManage showvminfo node-01 --machinereadable
name="node-01"
groups="/"
ostype="Other/Unknown"
UUID="7140d136-0aff-40a2-9cb4-ae5385b4f46a"
CfgFile="/home/user/.terraform/virtualbox/machine/node-01/node-01.vbox"
SnapFldr="/home/user/.terraform/virtualbox/machine/node-01/Snapshots"
LogFldr="/home/user/.terraform/virtualbox/machine/node-01/Logs"
hardwareuuid="7140d136-0aff-40a2-9cb4-ae5385b4f46a"
memory=128
pagefusion="off"
vram=8
cpuexecutioncap=100
hpet="off"
chipset="piix3"
firmware="BIOS"
cpus=1
pae="on"
longmode="on"
triplefaultreset="off"
apic="on"
x2apic="off"
cpuid-portability-level=0
bootmenu="messageandmenu"
boot1="floppy"
boot2="dvd"
boot3="disk"
boot4="none"
acpi="on"
ioapic="off"
biosapic="apic"
biossystemtimeoffset=0
rtcuseutc="off"
hwvirtex="on"
nestedpaging="on"
largepages="off"
vtxvpid="on"
vtxux="on"
paravirtprovider="default"
effparavirtprovider="none"
VMState="poweroff"
VMStateChangeTime="2019-08-26T06:50:03.000000000"
monitorcount=1
accelerate3d="off"
accelerate2dvideo="off"
teleporterenabled="off"
teleporterport=0
teleporteraddress=""
teleporterpassword=""
tracing-enabled="off"
tracing-allow-vm-access="off"
tracing-config=""
autostart-enabled="off"
autostart-delay=0
defaultfrontend=""
natnet1="nat"
macaddress1="080027BF56EC"
cableconnected1="on"
nic1="nat"
nictype1="Am79C973"
nicspeed1="0"
mtu="0"
sockSnd="64"
sockRcv="64"
tcpWndSnd="64"
tcpWndRcv="64"
nic2="none"
nic3="none"
nic4="none"
nic5="none"
nic6="none"
nic7="none"
nic8="none"
hidpointing="ps2mouse"
hidkeyboard="ps2kbd"
uart1="off"
uart2="off"
uart3="off"
uart4="off"
lpt1="off"
lpt2="off"
audio="pulse"
audio_in="false"
audio_out="false"
clipboard="disabled"
draganddrop="disabled"
vrde="off"
usb="off"
ehci="off"
xhci="off"
GuestMemoryBalloon=0
Code: Select all
VBoxManage clonehd /home/user/.terraform/virtualbox/gold/CentOS-7-x86_64-Vagrant-1907_01.VirtualBox/centos-7-1-1.x86_64.vmdk /home/user/.terraform/virtualbox/machine/node-01/centos-7-1-1.x86_64.vmdk
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Code: Select all
VBoxManage storagectl node-01 --name SATA --add sata --portcount 2 --controller IntelAHCI --hostiocache on --bootable on
Code: Select all
VBoxManage storageattach node-01 --storagectl SATA --port 0 --device 0 --type hdd --medium /home/user/.terraform/virtualbox/machine/node-01/centos-7-1-1.x86_64.vmdk
Code: Select all
VBoxManage modifyvm node-01 --firmware bios --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 0 --biosbootmenu disabled --ostype Linux_64 --cpus 2 --memory 512 --vram 20 --acpi on --ioapic on --rtcuseutc on --cpuhotplug off --pae on --longmode on --hpet off --hwvirtex on --triplefaultreset off --nestedpaging on --largepages on --vtxvpid on --vtxux on --accelerate3d off --boot1 disk --boot2 none --boot3 none --boot4 none --nic1 hostonly --nictype1 82545EM --cableconnected1 on --hostonlyadapter1 vboxnet1
Code: Select all
VBoxManage showvminfo node-01 --machinereadable
name="node-01"
groups="/"
ostype="Other Linux (64-bit)"
UUID="7140d136-0aff-40a2-9cb4-ae5385b4f46a"
CfgFile="/home/user/.terraform/virtualbox/machine/node-01/node-01.vbox"
SnapFldr="/home/user/.terraform/virtualbox/machine/node-01/Snapshots"
LogFldr="/home/user/.terraform/virtualbox/machine/node-01/Logs"
hardwareuuid="7140d136-0aff-40a2-9cb4-ae5385b4f46a"
memory=512
pagefusion="off"
vram=20
cpuexecutioncap=100
hpet="off"
chipset="piix3"
firmware="BIOS"
cpus=2
pae="on"
longmode="on"
triplefaultreset="off"
apic="on"
x2apic="off"
cpuid-portability-level=0
bootmenu="disabled"
boot1="disk"
boot2="none"
boot3="none"
boot4="none"
acpi="on"
ioapic="on"
biosapic="apic"
biossystemtimeoffset=0
rtcuseutc="on"
hwvirtex="on"
nestedpaging="on"
largepages="on"
vtxvpid="on"
vtxux="on"
paravirtprovider="default"
effparavirtprovider="kvm"
VMState="poweroff"
VMStateChangeTime="2019-08-26T06:50:03.000000000"
monitorcount=1
accelerate3d="off"
accelerate2dvideo="off"
teleporterenabled="off"
teleporterport=0
teleporteraddress=""
teleporterpassword=""
tracing-enabled="off"
tracing-allow-vm-access="off"
tracing-config=""
autostart-enabled="off"
autostart-delay=0
defaultfrontend=""
storagecontrollername0="SATA"
storagecontrollertype0="IntelAhci"
storagecontrollerinstance0="0"
storagecontrollermaxportcount0="30"
storagecontrollerportcount0="2"
storagecontrollerbootable0="on"
"SATA-0-0"="/home/user/.terraform/virtualbox/machine/node-01/centos-7-1-1.x86_64.vmdk"
"SATA-ImageUUID-0-0"="a6dd8d81-d767-4249-9f87-5b151c4cfcfc"
"SATA-1-0"="none"
hostonlyadapter1="vboxnet1"
macaddress1="080027DC83C1"
cableconnected1="on"
nic1="hostonly"
nictype1="82545EM"
nicspeed1="0"
nic2="none"
nic3="none"
nic4="none"
nic5="none"
nic6="none"
nic7="none"
nic8="none"
hidpointing="ps2mouse"
hidkeyboard="ps2kbd"
uart1="off"
uart2="off"
uart3="off"
uart4="off"
lpt1="off"
lpt2="off"
audio="pulse"
audio_in="false"
audio_out="false"
clipboard="disabled"
draganddrop="disabled"
vrde="off"
usb="off"
ehci="off"
xhci="off"
GuestMemoryBalloon=0
Code: Select all
VBoxManage startvm node-01 --type headless
Waiting for VM "node-01" to power on...
VM "node-01" has been successfully started.
Code: Select all
VBoxManage showvminfo 7140d136-0aff-40a2-9cb4-ae5385b4f46a --machinereadable
name="node-01"
groups="/"
ostype="Other Linux (64-bit)"
UUID="7140d136-0aff-40a2-9cb4-ae5385b4f46a"
CfgFile="/home/user/.terraform/virtualbox/machine/node-01/node-01.vbox"
SnapFldr="/home/user/.terraform/virtualbox/machine/node-01/Snapshots"
LogFldr="/home/user/.terraform/virtualbox/machine/node-01/Logs"
hardwareuuid="7140d136-0aff-40a2-9cb4-ae5385b4f46a"
memory=512
pagefusion="off"
vram=20
cpuexecutioncap=100
hpet="off"
chipset="piix3"
firmware="BIOS"
cpus=2
pae="on"
longmode="on"
triplefaultreset="off"
apic="on"
x2apic="off"
cpuid-portability-level=0
bootmenu="disabled"
boot1="disk"
boot2="none"
boot3="none"
boot4="none"
acpi="on"
ioapic="on"
biosapic="apic"
biossystemtimeoffset=0
rtcuseutc="on"
hwvirtex="on"
nestedpaging="on"
largepages="on"
vtxvpid="on"
vtxux="on"
paravirtprovider="default"
effparavirtprovider="kvm"
VMState="running"
VMStateChangeTime="2019-08-26T06:51:29.566000000"
monitorcount=1
accelerate3d="off"
accelerate2dvideo="off"
teleporterenabled="off"
teleporterport=0
teleporteraddress=""
teleporterpassword=""
tracing-enabled="off"
tracing-allow-vm-access="off"
tracing-config=""
autostart-enabled="off"
autostart-delay=0
defaultfrontend=""
storagecontrollername0="SATA"
storagecontrollertype0="IntelAhci"
storagecontrollerinstance0="0"
storagecontrollermaxportcount0="30"
storagecontrollerportcount0="2"
storagecontrollerbootable0="on"
"SATA-0-0"="/home/user/.terraform/virtualbox/machine/node-01/centos-7-1-1.x86_64.vmdk"
"SATA-ImageUUID-0-0"="a6dd8d81-d767-4249-9f87-5b151c4cfcfc"
"SATA-1-0"="none"
hostonlyadapter1="vboxnet1"
macaddress1="080027DC83C1"
cableconnected1="on"
nic1="hostonly"
nictype1="82545EM"
nicspeed1="0"
nic2="none"
nic3="none"
nic4="none"
nic5="none"
nic6="none"
nic7="none"
nic8="none"
hidpointing="ps2mouse"
hidkeyboard="ps2kbd"
uart1="off"
uart2="off"
uart3="off"
uart4="off"
lpt1="off"
lpt2="off"
audio="pulse"
audio_in="false"
audio_out="false"
clipboard="disabled"
draganddrop="disabled"
SessionName="headless"
VideoMode="720,400,0"@0,0 1
vrde="off"
usb="off"
ehci="off"
xhci="off"
VRDEActiveConnection="off"
VRDEClients=0
GuestMemoryBalloon=0
GuestOSType="Linux_64"
GuestAdditionsRunLevel=0
Code: Select all
VBoxManage guestproperty get node-01 /VirtualBox/GuestInfo/Net/0/MAC
No value set!
Code: Select all
VBoxManage guestproperty enumerate node-01
Name: /VirtualBox/HostInfo/GUI/LanguageID, value: ru_RU, timestamp: 1566802356433479000, flags: RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxVerExt, value: 5.2.18_Ubuntu, timestamp: 1566802289457896000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepExec, value: , timestamp: 1566802289457590000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepArgs, value: , timestamp: 1566802289457627000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxRev, value: 123745, timestamp: 1566802289457923000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxVer, value: 5.2.18, timestamp: 1566802289457868000, flags: TRANSIENT, RDONLYGUEST
Repeat:
example.tf
Code: Select all
resource "virtualbox_vm" "node" {
count = 1
name = format("node-%02d", count.index + 1)
image = "CentOS-7-x86_64-Vagrant-1907_01.VirtualBox.box"
cpus = 2
memory = "512 mib"
user_data = file("user_data")
network_adapter {
type = "hostonly"
host_interface = "vboxnet1"
}
}
output "IPAddr" {
value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 1)
}