This repository has been archived by the owner on May 6, 2019. It is now read-only.
forked from fnichol/omnibus-puppet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
76 lines (62 loc) · 2.01 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
68
69
70
71
72
73
74
75
76
# -*- mode: ruby -*-
# vi: set ft=ruby :
require "vagrant"
require "json"
VAGRANTFILE_API_VERSION=2
if Vagrant::VERSION < "1.2.1"
raise "The Omnibus Build Lab is only compatible with Vagrant 1.2.1+"
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
host_project_path = File.expand_path("..", __FILE__)
guest_project_path = "/home/vagrant/#{File.basename(host_project_path)}"
project_name = ENV['OMNIBUS_PROJECT'] || "puppet"
servers = JSON.load(File.read("./servers.json"))
config.vm.hostname = "#{project_name}-omnibus-build-lab"
config.vm.provider :virtualbox do |vb|
# Give enough horsepower to build without taking all day.
vb.customize [
"modifyvm", :id,
"--memory", "1536",
"--cpus", "2"
]
end
if Vagrant::VERSION < "1.3.0"
config.ssh.max_tries = 40
config.ssh.timeout = 120
end
config.ssh.forward_agent = true
config.vm.synced_folder host_project_path, guest_project_path
servers.each do |name, attrs|
config.vm.define name do |c|
c.berkshelf.berksfile_path = attrs['berksfile_path']
c.vm.box = attrs['box']
c.vm.box_url = attrs['box_url']
# Make sure that we have updated the repo lists in case of apt-get
c.vm.provision :shell do |s|
s.path = "./build-scripts/apt-get-update.sh"
end
# prepare VM to be an Omnibus builder
c.vm.provision :chef_solo do |chef|
chef.json = {
"omnibus" => {
"build_user" => "vagrant",
"build_dir" => guest_project_path,
"install_dir" => "/opt/puppet",
"ruby_version" => "2.0.0"
}
}
attrs['recipes'].each do |recipe|
chef.add_recipe recipe
end
end
c.vm.provision :shell do |s|
s.path = "./build-scripts/build.sh"
s.args = [guest_project_path, project_name]
s.privileged = false
end
end
end
config.omnibus.chef_version = :latest
config.berkshelf.enabled = true
config.berkshelf.berksfile_path = "./Berksfile"
end