-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
executable file
·79 lines (66 loc) · 2.32 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
77
78
79
# -*- mode: ruby -*-
# vim: set ft=ruby :
MACHINES = {
:raid => {
:box_name => "centos/7",
:ip_addr => "10.10.10.2",
:disks => {
:sata1 => {
:dfile => "./sata1.vdi",
:size => 250,
:port => 1
},
:sata2 => {
:dfile => "./sata2.vdi",
:size => 250, # Megabytes
:port => 2
},
:sata3 => {
:dfile => "./sata3.vdi",
:size => 250, # Megabytes
:port => 3
},
:sata4 => {
:dfile => "./sata4.vdi",
:size => 250, # Megabytes
:port => 4
},
:sata5 => {
:dfile => "./sata5.vdi",
:size => 250, # Megabytes
:port => 5
}
}
},
}
Vagrant.configure("2") do |config|
MACHINES.each do |boxname, boxconfig|
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define boxname do |box|
box.vm.box = boxconfig[:box_name]
box.vm.host_name = boxname.to_s
box.vm.network "private_network", ip: boxconfig[:ip_addr]
box.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--cpus", "1"]
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--audio", "none"]
needsController = false
boxconfig[:disks].each do |dname, dconf|
unless File.exist?(dconf[:dfile])
vb.customize ["createhd", "--filename", dconf[:dfile], "--variant", "Fixed", "--size", dconf[:size]]
needsController = true
end
end
if needsController == true
vb.customize ["storagectl", :id, "--name", "SATA", "--add", "sata" ]
boxconfig[:disks].each do |dname, dconf|
vb.customize ["storageattach", :id, "--storagectl", "SATA", "--port", dconf[:port], "--device", 0, "--type", "hdd", "--medium", dconf[:dfile]]
end
end
end
box.vm.provision "shell", inline: <<-SHELL
yum install -y mdadm smartmontools hdparm gdisk
SHELL
end
end
end