ruby Paralells的Vagrantfile #vagrant

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby Paralells的Vagrantfile #vagrant相关的知识,希望对你有一定的参考价值。

# -*- mode: ruby -*
# vi: set ft=ruby

$hostfile = <<HOSTFILE
Add-Content $ENV:windir\\System32\\drivers\\etc\\hosts "192.168.56.3 `t `t chefserver.dev.local"
Add-Content $ENV:windir\\System32\\drivers\\etc\\hosts "192.168.56.3 `t `t chefserver"
netsh advfirewall set allprofiles state off
HOSTFILE

Vagrant.configure(2) do |config|
  config.vm.box_check_update = false
  config.vm.define 'lab01' do |lab01_config|
    lab01_config.vm.box = 'windows_server_2016_core'
    lab01_config.vm.hostname = 'lab01'
    lab01_config.vm.network 'private_network', ip: '192.168.56.10'

    lab01_config.vm.provider 'parallels' do |prl|
      prl.linked_clone = true
    end

    lab01_config.vm.provision 'shell', inline: $hostfile
  end

  config.vm.define 'lab02' do |lab02_config|
    lab02_config.vm.box = 'windows_server_2016'
    lab02_config.vm.hostname = 'lab02'
    lab02_config.vm.network 'private_network', ip: '192.168.56.20'

    lab02_config.vm.provider 'parallels' do |prl|
      prl.linked_clone = true
    end

    lab02_config.vm.provision 'shell', inline: $hostfile
  end

  config.vm.define 'chefserver' do |chefserver_config|
    chefserver_config.vm.box = 'bento/ubuntu-14.04'
    chefserver_config.vm.hostname = 'chefserver'
    chefserver_config.vm.network 'private_network', ip: '192.168.56.3'

    chefserver_config.vm.provider 'parallels' do |v|
      v.linked_clone = true
      v.memory = 4096
      v.cpus = 2
    end

    chefserver_config.vm.provider 'parallels' do |prl|
      prl.linked_clone = true
    end

    chefserver_config.vm.provision 'shell', inline: <<-SHELL
	 sudo apt-get update && sudo apt-get upgrade -y
	 apt-get install -y wget git curl
	 echo "127.0.0.1 chefserver.dev.local chefserver" >> /etc/hosts
	 echo "192.168.56.10  lab01.mds.local lab01" >> /etc/hosts
	 echo "192.168.56.20  lab02.mds.local lab02" >> /etc/hosts
	 SHELL
  end
end

以上是关于ruby Paralells的Vagrantfile #vagrant的主要内容,如果未能解决你的问题,请参考以下文章

Ruby 25 岁了!Ruby 之父说 Ruby 3 有望 3 倍提速

如何学习ruby?Ruby学习技巧分享

什么是ruby?

ruby入门知识:了解ruby历史及特性

ruby 我无法相信这是有效的Ruby语法。附: - 我喜欢Ruby

Ruby 1.8 和 Ruby 1.9 有啥区别