-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile-topic-351
126 lines (104 loc) · 5.05 KB
/
Vagrantfile-topic-351
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Enable experimental features
ENV["VAGRANT_EXPERIMENTAL"] = "Disks"
# Plugins
required_plugins = ["vagrant-vmware-desktop", "vagrant-reload", "vagrant-disksize"]
required_plugins.each do |plugin|
unless Vagrant.has_plugin?(plugin)
system "vagrant plugin install #{plugin}"
puts "Installed the #{plugin} plugin."
end
end
Vagrant.configure("2") do |config|
# LOCAL VARIABLES
VM_NAME = "lpic3-topic-351"
BOX_NAME = "generic/debian12"
# BOX
config.vm.box = BOX_NAME
config.vm.box_download_insecure = true
# MOUNTS
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder "../scripts/", "/home/vagrant/scripts"
config.vm.synced_folder "../configs/", "/home/vagrant/configs"
config.vm.synced_folder "../security/", "/home/vagrant/security"
# STORAGE
config.vm.disk :disk, size: "200GB", name: "xen_storage", primary: false
# BEGIN INSTANCE 1
config.vm.define "#{VM_NAME}-instance-1" do |instance1|
# hostname
instance1.vm.hostname = "#{VM_NAME}-instance-1"
# VMware Workstation configuration
instance1.vm.provider "vmware_workstation" do |vmware|
vmware.linked_clone = true
vmware.clone_directory = "E:\\Servers\\VMWare\\#{VM_NAME}-instance-1"
vmware.whitelist_verified = true
vmware.gui = true
#vmware.vmx["virtualHW.version"] = "10"
vmware.vmx["displayName"] = "#{VM_NAME}-instance-1"
vmware.vmx["memsize"] = "65536"
vmware.vmx["numvcpus"] = "16"
vmware.vmx["cpuid.coresPerSocket"] = "1"
vmware.vmx["vhv.enable"] = "TRUE" # Enable virtualization engine (nested virtualization)
#vmware.vmx["hypervisor.cpuid.v0"] = "FALSE" # Ensure guest OS can see CPU features
#vmware.vmx["monitor.virtual_mmu"] = "hardware" # Use hardware memory management unit
#vmware.vmx["monitor.virtual_exec"] = "hardware" # Use hardware execution virtualization
end
# NETWORK CONFIGURATION
instance1.vm.network "public_network", mode: "bridge", auto_config: false
# manual ip
instance1.vm.provision "shell", name: "[configure-network]", path: "../scripts/network/configure-network-instance1.sh", privileged: true
# CLOUD-INIT
instance1.vm.provision "shell", name: "[cloud-init]", path: "../scripts/commons/cloud-init.sh", privileged: false
# STORAGE CONFIGURATION
instance1.vm.provision "shell", name: "[xen-storage]", path: "../scripts/storage/xen-storage.sh", privileged: true
# XEN SERVER SETUP
instance1.vm.provision "shell", name: "[xen-debian]", path: "../scripts/xen/debian.sh", privileged: true
instance1.vm.provision :reload
end
# END INSTANCE 1
# # BEGIN INSTANCE 2
# config.vm.define "#{VM_NAME}-instance-2" do |instance2|
# # hostname
# instance2.vm.hostname = "#{VM_NAME}-instance-2"
# # VMware Workstation configuration
# instance2.vm.provider "vmware_workstation" do |vmware|
# vmware.linked_clone = false
# vmware.clone_directory = "E:\\Servers\\VMWare\\#{VM_NAME}-instance-2"
# vmware.whitelist_verified = true
# vmware.gui = true
# #vmware.vmx["virtualHW.version"] = "10"
# vmware.vmx["displayName"] = "#{VM_NAME}-instance-2"
# vmware.vmx["memsize"] = "32768"
# vmware.vmx["numvcpus"] = "8"
# vmware.vmx["cpuid.coresPerSocket"] = "2"
# vmware.vmx["vhv.enable"] = "TRUE" # Enable virtualization engine (nested virtualization)
# #vmware.vmx["hypervisor.cpuid.v0"] = "FALSE" # Ensure guest OS can see CPU features
# #vmware.vmx["monitor.virtual_mmu"] = "hardware" # Use hardware memory management unit
# #vmware.vmx["monitor.virtual_exec"] = "hardware" # Use hardware execution virtualization
# end
# # NETWORK CONFIGURATION
# instance2.vm.network "public_network", mode: "bridge", auto_config: false
# # manual ip
# instance2.vm.provision "shell", name: "[configure-network]", path: "../scripts/network/configure-network-instance2.sh", privileged: true
# # instance2.vm.provision "shell",
# # run: "always",
# # inline: "ifconfig eth1 192.168.0.131 netmask 255.255.255.0 up"
# # # default router
# # instance2.vm.provision "shell",
# # run: "always",
# # inline: "route add default gw 192.168.0.1"
# # # delete default gw on eth0
# # instance2.vm.provision "shell",
# # run: "always",
# # inline: "eval `route -n | awk '{ if ($8 ==\"eth0\" && $2 != \"0.0.0.0\") print \"route del default gw \" $2; }'`"
# # CLOUD-INIT
# instance2.vm.provision "shell", name: "[cloud-init]", path: "../scripts/commons/cloud-init.sh", privileged: false
# # STORAGE CONFIGURATION
# instance2.vm.provision "shell", name: "[xen-storage]", path: "../scripts/storage/xen-storage.sh", privileged: true
# # XEN SERVER SETUP
# instance2.vm.provision "shell", name: "[xen-debian]", path: "../scripts/xen/debian.sh", privileged: true
# instance2.vm.provision :reload
# end
# # end instance 2
end