-
Notifications
You must be signed in to change notification settings - Fork 2
/
Vagrantfile
52 lines (51 loc) · 1.49 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
# Describe VMs
MACHINES = {
# VM name "manual kernel update"
:"manual-kernel-update" => {
# VM box
:box_name => "centos-7-5-manual_kernel_update_v2",
# VM CPU count
:cpus => 2,
# VM RAM size (Mb)
:memory => 1024,
# networks
:net => [],
# forwarded ports
:forwarded_port => []
}
}
Vagrant.configure("2") do |config|
MACHINES.each do |boxname, boxconfig|
# Disable shared folders
config.vm.synced_folder ".", "/vagrant", disabled: true
# Apply VM config
config.vm.define boxname do |box|
# Set VM base box and hostname
box.vm.box = boxconfig[:box_name]
box.vm.host_name = boxname.to_s
# Additional network config if present
if boxconfig.key?(:net)
boxconfig[:net].each do |ipconf|
box.vm.network "private_network", ipconf
end
end
# Port-forward config if present
if boxconfig.key?(:forwarded_port)
boxconfig[:forwarded_port].each do |port|
box.vm.network "forwarded_port", port
end
end
# VM resources config
box.vm.provider "virtualbox" do |v|
# Set VM RAM size and CPU count
v.memory = boxconfig[:memory]
v.cpus = boxconfig[:cpus]
end
config.ssh.insert_key = false
box.vm.provision "shell", inline: <<-SHELL
mkdir -p ~root/.ssh
cp ~vagrant/.ssh/auth* ~root/.ssh
SHELL
end
end
end