Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant use different host machine

I want to use Vagrant but not pollute my machine which I'm working on with n+ VirtualBox machines.

I searched the web but found nothing. What I really want is working on my Laptop and invoking vagrant up there but the it should start the guest on another e.g. Linux computer on my network which have VirtualBox installed.

Is that possible at this time, because it's not much different then the aws-provider which does exactly that with EC2.

Would also be nice if it would use NTFS instead of the aws-provider which uses rsync.

Thanks for your answers in advance. Daniel

like image 683
Daniel Spangenberg Avatar asked Mar 16 '13 18:03

Daniel Spangenberg


1 Answers

Since vagrant doesn't support this directly, I'd do something like this.

First, keep all your Vagrantfiles in subdirectories of the same directory on the host server. Then create a vagrant_runner script on your host machine looking something like this:

#!/bin/bash
VAGRANT_HOME='/home/bar/vagrant'

cd ${VAGRANT_HOME}/$1
# Strip off the subdir name so we can pass all the rest of our
# arguments to vagrant
shift
vagrant $@

Then on your laptop you would have a rvagrant script:

#!/bin/bash
VAGRANT_HOST=dnsname_of_vagrant_host
VAGRANT_USER=vagrant_user

ssh ${VAGRANT_USER}@${VAGRANT_HOST} vagrant_runner $@

Then you could do rvagrant foo up to kick off the vms defined in /home/bar/vagrant/foo/Vagrantfile, or rvagrant foo destroy -f to destroy it.

like image 199
Joe Block Avatar answered Oct 20 '22 16:10

Joe Block