-
Notifications
You must be signed in to change notification settings - Fork 28
/
Vagrantfile
42 lines (29 loc) · 1.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
require 'json'
VAGRANTFILE_API_VERSION = "2"
DEFAULT_CLUSTER = "vagrant"
base_dir = File.expand_path(File.dirname(__FILE__))
cluster = JSON.parse(IO.read(File.join(base_dir, "clusters", ENV['CLUSTER'] || DEFAULT_CLUSTER, "cluster.json")))
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :machine
config.cache.enable :apt
end
cluster.each do |hostname, info|
config.vm.define hostname do |cfg|
cfg.vm.provider :virtualbox do |vb, override|
override.vm.box = "trusty64"
override.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
override.vm.network :private_network, ip: "#{info["ip"]}"
override.vm.hostname = hostname
vb.name = 'vagrant-mesos-' + hostname
vb.customize ["modifyvm", :id, "--memory", info["config"]["mem"], "--cpus", info["config"]["cpus"], "--hwvirtex", "on" ]
end
# provision nodes with ansible
cfg.vm.provision :ansible do |ansible|
ansible.verbose = "v"
ansible.inventory_path = "ansible/vagrant"
ansible.playbook = "ansible/#{info["playbook"]}"
end
end
end
end