-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
77 lines (65 loc) · 2.37 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
# -*- mode: ruby -*-
# vim: set ft=ruby :
home = ENV['HOME']
ENV["LC_ALL"] = "en_US.UTF-8"
MACHINES = {
:lvm => {
:box_name => "centos/7",
:box_version => "1804.02",
:ip_addr => '192.168.11.101',
:disks => {
:sata1 => {
:dfile => home + '/VirtualBox VMs/sata1.vdi',
:size => 10240,
:port => 1
},
:sata2 => {
:dfile => home + '/VirtualBox VMs/sata2.vdi',
:size => 2048, # Megabytes
:port => 2
},
:sata3 => {
:dfile => home + '/VirtualBox VMs/sata3.vdi',
:size => 1024, # Megabytes
:port => 3
},
:sata4 => {
:dfile => home + '/VirtualBox VMs/sata4.vdi',
:size => 1024,
:port => 4
}
}
},
}
Vagrant.configure("2") do |config|
config.vm.box_version = "1804.02"
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", "256"]
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 vim xfsdump
SHELL
end
end
end