2

I have followed the 'getting start' section of vagrant documentation and successfully brought up a virtual box machine using the hashicorp/precise32 box image

vagrant init hashicorp/precise32
vagrant up

Now I want to create a new 64 bit ubuntu box. I have successfully added a new box

$ vagrant box list
chef/ubuntu-13.10   (virtualbox, 1.0.0)
hashicorp/precise32 (virtualbox, 1.0.0)

However vagrant up will only bring up the existing hashicorp/precise32 box.

Which section of documentation is related to creating second machine? Do I need to separate VagrantFile for this?

1 Answer 1

1

You can edit the existing Vagrantfile, and add another box.

As an example:

  # Every Vagrant virtual environment requires a box to build off of.
  # config.vm.box = "base"

  config.vm.define :centos6 do |node1|
    node1.vm.hostname = 'centos.internal'
    node1.vm.box      = 'centos-65-x64-virtualbox-nocm.box'
    node1.vm.box_url  = 'http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box'
    node1.vm.network :private_network, ip: "10.200.0.10"
  end

  config.vm.define :precise do |node2|
    node2.vm.hostname = "precise"
    node2.vm.box      = 'ubuntu-server-12042-x64-vbox4210-nocm.box'
    node2.vm.box_url  = 'http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box'
    node2.vm.network :private_network, ip: "10.200.0.11"
  end

This is a section taken from a Vagrantfile created using vagrant init

The automatically created box "base" has been commented out, and two new boxes have been added. In order to bring these boxes up, you can use vagrant up [boxname], for example vagrant up centos6

if you omit the argument, and just run vagrant up, all boxes list will be brought up, in the order they are defined in the Vagrantfile.

You can check the current status of the boxes in the Vagrantile by using vagrant status:

$ vagrant status
Current machine states:

centos6                   not created (vmware_fusion)
precise                   not created (vmware_fusion)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .