-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
67 lines (54 loc) · 2.23 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
64
65
66
67
require 'berkshelf/vagrant'
boxname = ENV['PLAYGROUND_BOXNAME'] || "opscode_ubuntu-12.04"
chef_version = ENV['PLAYGROUND_CHEF'] || "10.18.2"
current_dir = File.dirname(__FILE__)
host_cache_path = File.join(current_dir,
"cache")
validation_key_path = File.join(host_cache_path,
"chef-validator.pem")
guest_cache_path = "/tmp/chef-vagrant-cache"
# ensure the cache path exists
FileUtils.mkdir(host_cache_path) unless File.exist?(host_cache_path)
Vagrant::Config.run do |config|
config.vm.customize ["modifyvm", :id, "--cpus", 2]
config.vm.customize ["modifyvm", :id, "--memory", 1024]
config.vm.host_name = "chef-server-berkshelf"
config.vm.box = "#{boxname}"
config.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/#{boxname}_chef-#{chef_version}.box"
config.ssh.max_tries = 40
config.ssh.timeout = 120
config.ssh.forward_agent = true
config.vm.define :chef_server do |vm_config|
vm_config.vm.forward_port 443, 4443
vm_config.vm.host_name = "chef-server-berkshelf"
vm_config.vm.network :hostonly, "33.33.33.10"
vm_config.vm.share_folder "cache", guest_cache_path, host_cache_path
vm_config.vm.provision :shell, :path => "scripts/add_chef_server_etc_hosts.sh"
vm_config.vm.provision :chef_solo do |chef|
chef.provisioning_path = guest_cache_path
chef.json = {
"chef-server" => {
"version" => "latest",
"prereleases" => true,
"nightlies" => true
}
}
chef.run_list = [
"recipe[chef-server::default]"
]
end
# Copy over the validator pem, admin pem, so Knife works in the
# parent directory
vm_config.vm.provision :shell, :path => "scripts/chef_postinstall_script.sh"
end
config.vm.define :test_server do |vm_config|
vm_config.vm.host_name = "test-server"
vm_config.vm.network :hostonly, "33.33.33.40"
vm_config.vm.provision :shell, :path => "scripts/add_chef_server_etc_hosts.sh"
vm_config.vm.provision :chef_client do |chef|
chef.chef_server_url = "https://chef-server-berkshelf"
chef.validation_client_name = "chef-validator"
chef.validation_key_path = validation_key_path
end
end
end