-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
52 lines (47 loc) · 1.39 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "chef/centos-6.5"
config.ssh.insert_key = false
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.memory = 512
end
IP_OFFSET = 100
MASTERS_COUNT = 1
SLAVES_COUNT = 2
masters = []
MASTERS_COUNT.times do |i|
node_id = "mesosmaster#{i}"
masters.push(node_id)
config.vm.define node_id do |master|
guest_ip = "192.168.50.#{IP_OFFSET + i + 1}"
master.vm.network :private_network, ip: guest_ip
master.vm.hostname = node_id
end
end
slaves = []
SLAVES_COUNT.times do |i|
node_id = "mesosslave#{i}"
slaves.push(node_id)
config.vm.define node_id do |slave|
guest_ip = "192.168.50.#{IP_OFFSET + MASTERS_COUNT + i + 1}"
slave.vm.network :private_network, ip: guest_ip
slave.vm.hostname = node_id
if i == SLAVES_COUNT - 1
# If at the last slave, kick off ansible provisioning for the cluster
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
slave.vm.provision :ansible do |ansible|
ansible.playbook = 'playbook.yml'
ansible.limit = 'all'
ansible.groups = {
"masters" => masters,
"slaves" => slaves
}
end
end
end
end
end