# First instance:
mkdir vagrant
cd vagrant
vagrant init
vagrant up
# Second instance:
cd ..
cp -r vagrant vagrant2
rm .vagrant
vagrant up
On Mar 12, 12:46 pm, Mitchell Hashimoto <mitchell.hashim...@gmail.com>
wrote:
> Mike,
>
> This is certainly possible. Each time you run "vagrant up," it creates a
> copy of the box specific to that project (that Vagrantfile). By creating
> multiple Vagrantfiles in multiple directories and pointing them to the same
> base, you'll create multiple instances of the same box.
>
> The only thing to watch out for, and its something that will be addressed in
> the next version (0.2) of Vagrant, is to make sure that the ports don't
> collide with each other. By default SSH is set to forward to port 2222 on
> the host machine. This can be changed in the Vagrantfile like so, where 1234
> in the following example is what port to forward to on your host machine:
>
> config.vm.forward_port("ssh", 22, 1234)
>
> If you're forwarding any other ports (http, ftp, etc.) you'll want to be
> careful of those as well. In the next release of Vagrant, we'll actually
> build in port collision detection, but for now this must be watched
> manually.
>
> Mitchell
>
servers=[
{
:hostname => "web",
:ip => "192.168.100.10",
:box => "saucy",
:ram => 1024,
:cpu => 2
},
{
:hostname => "db",
:ip => "192.168.100.11",
:box => "saucy",
:ram => 2048,
:cpu => 4
}
]Vagrant.configure(2) do |config|
servers.each do |machine|
config.vm.define machine[:hostname] do |node|
node.vm.box = machine[:box]
node.vm.hostname = machine[:hostname]
node.vm.network "private_network", ip: machine[:ip]
node.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", machine[:ram]]