/
Vagrantfile
63 lines (54 loc) · 2.09 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
user = ( ENV['USER'] || ENV['USERNAME'] ).downcase
sync_folder = '/chef-repo'
chef_recipe = ["chef_workstation::default"]
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise64"
config.vm.hostname = "chef-workstation"
config.vm.synced_folder ".", sync_folder
config.ssh.forward_agent = true
config.vm.provider "parallels" do |v, override|
override.vm.box = "parallels/ubuntu-12.04"
v.update_guest_tools = true
v.optimize_power_consumption = false
v.cpus = 2
v.memory = 2048
end
config.vm.provider "hyperv" do |hv|
hv.ip_address_timeout = 240
end
config.vm.provider :virtualbox do |vb, override|
# NAT settings so network isn't super slow
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.memory = 1024
end
config.vm.provision "chef_solo" do |chef|
chef_recipe.each {|recipe| chef.add_recipe recipe}
chef.json = {
"chef_workstation" => {
"root_folder" => sync_folder,
"vagrant_version" => Vagrant::VERSION,
"chef_user" => user
}
}
end
if !Vagrant.has_plugin?("vagrant-omnibus")
raise Vagrant::Errors::VagrantError.new, "vagrant-omnibus must be installed. Install using \"sudo vagrant plugin install vagrant-omnibus\" before running \"vagrant up\""
end
if Vagrant.has_plugin?("vagrant-cachier")
if (is_windows)
raise Vagrant::Errors::VagrantError.new, "vagrant-cachier is not supoprted on Windows! Please uninstall using 'vagrant plugin uninstall vagrant-cachier'"
end
config.cache.scope = :box
config.cache.enable :generic, {
"wget" => { cache_dir: "/var/cache/wget" }
}
else
puts "\e[33mWARNING: vagrant-cachier not installed. Unable to cache dependencies between VM rebuilds.\e[0m"
puts "\e[33mInstall using: \"sudo vagrant plugin install vagrant-cachier\" before running \"vagrant up\" (unix only). \e[0m"
end
end