This seems like a simple task, but I've been chasing my tail on this for long enough that I thought I'd reach out and see if someone can give me a hand.
ENVIRONMENT:
Vagrant 1.3.1 on Windows (I know.. I'm working on building a CentOS LXC for Ubuntu Vagrant)
Virtualbox 4.2.18
Vagrantfile version 2
GOAL:
Add another (2nd) virtual disk to a box image. (I'll mount it with Chef cookbook etc.)
Q: Is there a way to get the host path to a VM being provisioned in the Vagrantfile. Meaning is there a variable with the full path or at least root path and then I can append the suggested hostname?
I'd like to not have to use a system environment variable like I started to code for...
EXAMPLE: (So far)
# Configuration for Virtualbox provider
config.vm.provider "virtualbox" do |vb|
# Memory
vb.customize [ "modifyvm", :id, "--memory", "1024" ]
# Chipset (Supposedly better CPU performance)
vb.customize [ "modifyvm", :id, "--chipset", "ich9" ]
# NIC 1 (Better TCP over NAT performance, at least on Windows)
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
vb.customize ["modifyvm", :id, "--natsettings1", "9000,1024,1024,1024,1024"]
# NIC 2 (Host Only Access)
vb.customize ["modifyvm", :id, "--nictype2", "virtio"]
vb.customize ["modifyvm", :id, "--hostonlyadapter2", "VirtualBox Host-Only Ethernet Adapter"]
# Add Second Drive
if ENV["VBOX_VM_PATH"]
disk2_path = ENV["VBOX_VM_PATH"] + :vm + "/" + "box-disk2" + ".vmdk"
else
disk2_path = Dir.pwd() + "/" + "box-disk2" + ".vmdk"
end
vb.customize ["storagectl", :id, "--name", "SATA", "--sataportcount", 2, "--hostiocache", "on"]
vb.customize ["createhd", "--filename", disk2_path, "--size", 30*1024, "--format", "vmdk"]
vb.customize ["storageattach", :id, "--storagectl", "SATA", "--port", 1, "--device", 0, "--type", "hdd", "--medium", disk2_path]
end
Thanks!