다른 방랑 기계를 프로비저닝하는 방법은 무엇입니까?

다른 방랑 기계를 프로비저닝하는 방법은 무엇입니까?

vagrant 문서의 '시작하기' 섹션을 따라 hashicorp/precise32상자 이미지를 사용하여 가상 상자 머신을 성공적으로 불러왔습니다.

vagrant init hashicorp/precise32
vagrant up

이제 새로운 64비트 우분투 박스를 만들고 싶습니다. 새 상자를 성공적으로 추가했습니다.

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

그러나 vagrant up기존 hashicorp/precise32 상자만 표시됩니다.

두 번째 시스템 생성과 관련된 문서 섹션은 무엇입니까? 이를 위해 VagrantFile을 분리해야 합니까?

답변1

기존 Vagrantfile을 편집하고 다른 상자를 추가할 수 있습니다.

예로서:

  # 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

이것은 다음을 사용하여 생성된 Vagrantfile에서 가져온 섹션입니다.vagrant init

자동으로 생성된 상자 "base"가 주석 처리되었으며 새 상자 2개가 추가되었습니다. 이러한 상자를 표시하려면 vagrant up [boxname]예를 들어 를 사용할 수 있습니다.vagrant up centos6

인수를 생략하고 그냥 실행하면 vagrant up모든 상자 목록이 Vagrantfile에 정의된 순서대로 표시됩니다.

다음을 사용하여 Vagrantile 상자의 현재 상태를 확인할 수 있습니다 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`.

관련 정보