VirtualBox Guest Additions由Vagrant在Windows环境中更新

时间:2017-03-22 14:02:14

标签: vagrant virtualbox

我有两个Windows Vagrant盒子(Win 7和Win 8)。我想在这个方框中自动更新Guest Additions。我尝试过vagrant-vbguest插件 - 但它不起作用 - 退出代码 - Sorry, don't know how to check guest version of VirtualBox Guest Additions on this platform. Stopping installation.

Vagrant版本: Installed Version: 1.9.2 VirtualBox版本: 5.1.18

Vagrantfile

Vagrant.configure("2") do |config|

  # General settings for all VMs
  config.vm.communicator = "winrm" 
  config.vm.boot_timeout = 600
  config.vm.graceful_halt_timeout = 600
  config.vm.network "public_network", auto_config: true
  config.vm.provision :shell, path: "Auto_Logon.ps1"
  config.vbguest.iso_path = "http://download.virtualbox.org/virtualbox/5.1.18/VBoxGuestAdditions_5.1.18.iso"

  # Win7 VM
  config.vm.define "win7" do |win7|
    win7.vm.box_url = "file:///VagrantBoxes_Win_Series/windows_7_virtualbox.box"
    win7.vm.box = "windows_7_virtualbox"
    configure_provider(win7, "Win_7_x64_Mult")
  end

  # Windows 8 VM
  config.vm.define "win8" do |win8|
    win8.vm.box_url = "file:///VagrantBoxes_Win_Series/Windows8_x64.box"
    win8.vm.box = "Windows8_x64"
    configure_provider(win8, "Win_8_x64_Mult")
  end

end

def configure_provider (node, node_name)
  node.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--usb", "on"]
    vb.customize ["modifyvm", :id, "--usbehci", "on"]
    vb.customize ["modifyvm", :id, "--accelerate3d", "on"]       
    vb.customize ['usbfilter', 'add', '0', '--target', :id, '--name', 'SmartCard', '--vendorid', '0x096E', '--productid', '0x0007']
    vb.customize ["modifyvm", :id, "--memory", "4096"]
    vb.customize ["modifyvm", :id, "--vram", "256"]
    vb.cpus = 2
    vb.gui = true
    vb.name = node_name
  end
end

0 个答案:

没有答案