forked from NikKisl/otus-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
75 lines (61 loc) · 2.11 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
# -*- mode: ruby -*-
# vim: set ft=ruby :
MACHINES = {
:otuslinux => {
:box_name => "centos/7",
:ip_addr => '192.168.11.101',
:disks => {
:sata1 => {
:dfile => './sata1.vdi',
:size => 250,
:port => 1
},
:sata2 => {
:dfile => './sata2.vdi',
:size => 250, # Megabytes
:port => 2
},
:sata3 => {
:dfile => './sata3.vdi',
:size => 250,
:port => 3
},
:sata4 => {
:dfile => './sata4.vdi',
:size => 250, # Megabytes
:port => 4
}
}
},
}
Vagrant.configure("2") do |config|
MACHINES.each do |boxname, boxconfig|
config.vm.define boxname do |box|
box.vm.box = boxconfig[:box_name]
box.vm.host_name = boxname.to_s
#box.vm.network "forwarded_port", guest: 3260, host: 3260+offset
box.vm.network "private_network", ip: boxconfig[:ip_addr]
box.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
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
mkdir -p ~root/.ssh
cp ~vagrant/.ssh/auth* ~root/.ssh
yum install -y mdadm smartmontools hdparm gdisk
SHELL
end
end
end