-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
75 lines (58 loc) · 2.42 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
# export VAGRANT_EXPERIMENTAL="disks"
# -*- mode: ruby -*-
# vim: set ft=ruby :
MACHINES = {
:otuslinux => {
# :box_name => "centos/7",
:ip_addr => '192.168.56.101',
:disks => {
:sata1 => {
:dfile => './sata1.vdi',
:size => 512,
:port => 1
},
:sata2 => {
:dfile => './sata2.vdi',
:size => 512,
:port => 2
},
:sata3 => {
:dfile => './sata3.vdi',
:size => 512,
:port => 3
}
}
},
}
Vagrant.configure("2") do |config|
MACHINES.each do |boxname, boxconfig|
config.vm.define boxname do |box|
box.vm.box = 'centos/8.4'
box.vm.box_url = 'https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-Vagrant-8.4.2105-20210603.0.x86_64.vagrant-virtualbox.box'
box.vm.box_download_checksum = 'dfe4a34e59eb3056a6fe67625454c3607cbc52ae941aeba0498c29ee7cb9ac22'
box.vm.box_download_checksum_type = 'sha256'
box.vm.synced_folder '.', '/vagrant', disabled: true
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, "--memory", "2048"]
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",
name: "Setup zfs",
path: "setup_zfs.sh"
end
end
end