-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
64 lines (56 loc) · 1.35 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
# Vagrantfile
VAGRANTFILE_API_VERSION = "2"
box = "ubuntu/trusty64"
machines = [
{
"hostname"=> "basestation",
"ip"=> "192.168.123.4",
"mem"=> 512,
"cpu"=> 2,
"ports"=> [ [5000, 8081] ],
"playbook"=> "basestations.yml"
},
{
"hostname"=> "sensor1",
"ip"=> "192.168.123.2",
"mem"=> 512,
"cpu"=> 2,
"ports"=> [ [5000, 8082] ],
"playbook"=> "sensors.yml"
},
{
"hostname"=> "user1",
"ip"=> "192.168.123.3",
"mem"=> 512,
"cpu"=> 2,
"ports"=> [],
"playbook"=> "users.yml"
}
]
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
machines.each do |i|
config.vm.define i["hostname"] do |machine|
machine.vm.box = box
machine.vm.host_name = i["hostname"]
machine.vm.network :private_network, ip: i["ip"]
i["ports"].each do |port|
machine.vm.network :forwarded_port, guest: port[0], host: port[1]
end
machine.vm.provider :virtualbox do |vb|
vb.customize [
"modifyvm", :id,
"--memory", i["mem"],
"--cpus", i["cpu"],
"--ioapic", "on",
]
end
machine.vm.provision "ansible" do |ansible|
ansible.playbook = i["playbook"]
ansible.inventory_path = "hosts"
ansible.verbose = "vvvv"
ansible.host_key_checking = false
ansible.limit = "local"
end
end
end
end