-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
185 lines (137 loc) · 5.23 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# #
# # -*- mode: ruby -*-
# # vi: set ft=ruby :
# # Some variables you might want to change later:
# # Vagrant:
VAGRANT_BASE = "generic/ubuntu2004"
VAGRANT_UPDATE = false
MOUNT_FOLDERS = true
# VirtualBox:
VBOX_NAME = "mint-dev"
VBOX_MEM = "8192"
VBOX_CPUS = "2"
VBOX_GUI = true
# Networking:
VM_HOSTNAME = "trshpuppy"
# Mount for ISO file:
ISO_FILE_PATH = "../iso/linuxmint-21.2-xfce-64bit.iso"
# Mounted folders:
HOST_SHARED_SCRIPTS_DIR = "../shared-scripts"
VM_SHARED_SCRIPTS_DIR = "/tmp/vagrant/shared-scripts"
HOST_SHARED_CONFIGS_DIR = "../shared-configs"
VM_SHARED_CONFIGS_DIR = "/tmp/vagrant/shared-configs"
HOST_CONFIG_DIR = "configs"
VM_CONFIG_DIR = "/tmp/vagrant/configs"
HOST_SCRIPTS_DIR = "scripts"
VM_SCRIPTS_DIR = "/tmp/vagrant/scripts"
VM_SHELL_PATH = "/usr/bin/bash"
Vagrant.configure("2") do |config|
# Define the VM box (Linux Mint)
config.vm.box = VAGRANT_BASE
# We want it to update:
config.vm.box_check_update = VAGRANT_UPDATE
# Don't sync Vagrant folder:
config.vm.synced_folder ".", "/vagrant", disabled: trueFALSE
# Set the VM hostname
config.vm.hostname = VM_HOSTNAME
# Configure VM resources
config.vm.provider "virtualbox" do |vb|
vb.memory = VBOX_MEM
vb.cpus = VBOX_CPUS
vb.gui = VBOX_GUI
end
# Give our box some config files, to make these real nice and automated:
# if MOUNT_FOLDERS
# config.vm.synced_folder HOST_SHARED_SCRIPTS_DIR, VM_SHARED_SCRIPTS_DIR, SharedFoldersEnableSymlinksCreate: false
# config.vm.synced_folder HOST_SHARED_CONFIGS_DIR, VM_SHARED_CONFIGS_DIR, SharedFoldersEnableSymlinksCreate: false
# config.vm.synced_folder HOST_CONFIG_DIR, VM_CONFIG_DIR, SharedFoldersEnableSymlinksCreate: false
# config.vm.synced_folder HOST_SCRIPTS_DIR, VM_SCRIPTS_DIR, SharedFoldersEnableSymlinksCreate: false
# end
# Mount and Boot the ISO:
config.vm.synced_folder "../iso", "/tmp/vagrant/iso"
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y virtualbox-guest-dkms
# Mount the ISO
sudo mount -o loop '/tmp/vagrant/linuxmint-21.2-xfce-64bit.iso' /mnt
# Install Mint
sudo /mnt/casper/vmlinuz file=/cdrom/preseed/linuxmint.seed boot=casper only-ubiquity quiet splash ---
SHELL
# # Forward ports (optional)
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Bootstrap script (optional)
# config.vm.provision "shell", path: "bootstrap.sh"
# Provisioning:
# config.vm.provision "shell",
# inline: "#{VM_SHELL_PATH} #{VM_SHARED_SCRIPTS_DIR}/install_shared_tools.sh"
end
# #
# # -*- mode: ruby -*-
# # vi: set ft=ruby :
# # Some variables you might want to change later:
# # Vagrant:
# VAGRANT_BASE = "ubuntu/focal64"
# VAGRANT_UPDATE = true
# MOUNT_FOLDERS = true
# # VirtualBox:
# VBOX_NAME = "ubuntu-dev"
# VBOX_MEM = "16000"
# VBOX_CPUS = "6"
# VBOX_GUI = false
# # Mounted folders:
# HOST_SHARED_SCRIPTS_DIR = "../shared-scripts"
# VM_SHARED_SCRIPTS_DIR = "/tmp/vagrant/shared-scripts"
# HOST_SHARED_CONFIGS_DIR = "../shared-configs"
# VM_SHARED_CONFIGS_DIR = "/tmp/vagrant/shared-configs"
# HOST_CONFIG_DIR = "configs"
# VM_CONFIG_DIR = "/tmp/vagrant/configs"
# HOST_SCRIPTS_DIR = "scripts"
# VM_SCRIPTS_DIR = "/tmp/vagrant/scripts"
# VM_SHELL_PATH = "/usr/bin/bash"
# # -------- START THE MADNESS:
# Vagrant.configure("2") do |config|
# # This is our box:
# config.vm.box = VAGRANT_BASE
# # We want it to update:
# config.vm.box_check_update = VAGRANT_UPDATE
# # We don't want the VM to access our Vfile:
# config.vm.synced_folder ".", "/vagrant", disabled: true
# # Give our box some config files, to make these real nice and automated:
# if MOUNT_FOLDERS
# config.vm.synced_folder HOST_SHARED_SCRIPTS_DIR, VM_SHARED_SCRIPTS_DIR, SharedFoldersEnableSymlinksCreate: false
# config.vm.synced_folder HOST_SHARED_CONFIGS_DIR, VM_SHARED_CONFIGS_DIR, SharedFoldersEnableSymlinksCreate: false
# config.vm.synced_folder HOST_CONFIG_DIR, VM_CONFIG_DIR, SharedFoldersEnableSymlinksCreate: false
# config.vm.synced_folder HOST_SCRIPTS_DIR, VM_SCRIPTS_DIR, SharedFoldersEnableSymlinksCreate: false
# end
# # ---- VirtualBox Config:
# config.vm.provider "virtualbox" do |vb|
# vb.name = VBOX_NAME
# # Display the VirtualBox GUI when booting the machine
# vb.gui = VBOX_GUI
# # Customize the amount of memory on the VM:
# vb.memory = VBOX_MEM
# vb.cpus = VBOX_CPUS
# end
# # ---- VirtualBox End:
# # ---- Provisioning:
# # We want to add our configure files before we install tools (probably):
# if MOUNT_FOLDERS
# # Config script:
# config.vm.provision "shell",
# inline: "#{VM_SHELL_PATH} #{VM_SHARED_SCRIPTS_DIR}/configure.sh"
# # Shared Scripts:
# config.vm.provision "shell",
# inline: "#{VM_SHELL_PATH} #{VM_SHARED_SCRIPTS_DIR}/install_shared_tools.sh"
# # Dev lab specific:
# config.vm.provision "shell",
# inline: "#{VM_SHELL_PATH} #{VM_SCRIPTS_DIR}/install_tools.sh"
# # Clean up and maintenance:
# config.vm.provision "shell",
# inline: "#{VM_SHELL_PATH} #{VM_SHARED_SCRIPTS_DIR}/maintenance.sh"
# else
# # Put custom provisioning here:
# next
# end
# # ---- Provisioning End:
# # -------- MADNESS FINISHED.
# end