-
Notifications
You must be signed in to change notification settings - Fork 7
/
Vagrantfile
61 lines (51 loc) · 2.13 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
Vagrant.configure("2") do |config|
config.vm.box = "tknerr/ubuntu2204-desktop"
config.vm.box_version = "23.1027.1"
# override the basebox when testing (an approximation) with docker
config.vm.provider :docker do |docker, override|
override.vm.box = "tknerr/baseimage-ubuntu-22.04"
override.vm.box_version = "1.0.0"
docker.create_args = [
# docker (in-docker) needs privileges for creating the docker socket
"--cap-add=NET_ADMIN",
# mount the X11 unix socket into the container
"-v", "/tmp/.X11-unix:/tmp/.X11-unix:rw"
]
end
# hostname
config.vm.hostname = 'dev-vm'
# virtualbox specific customizations
config.vm.provider "virtualbox" do |vbox, override|
vbox.cpus = 4
vbox.memory = 4096
vbox.customize ["modifyvm", :id, "--name", "Linux Developer VM"]
vbox.customize ["modifyvm", :id, "--usb", "on"]
vbox.customize ["modifyvm", :id, "--accelerate3d", "off"]
vbox.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
vbox.customize ["modifyvm", :id, "--vrde", "off"]
end
# vmware specific customizations
config.vm.provider "vmware_desktop" do |vmware, override|
vmware.vmx["displayname"] = "Linux Developer VM"
vmware.vmx["numvcpus"] = "4"
vmware.vmx["memsize"] = "4096"
vmware.vmx["usb.present"] = "TRUE"
vmware.vmx["usb.pcislotnumber"] = "33"
vmware.vmx["usb_xhci.present"] = "TRUE"
end
# parallels specific customizations
config.vm.provider "parallels" do |prl, override|
prl.customize ["set", :id, "--cpus", "4"]
prl.customize ["set", :id, "--memsize", "4096"]
prl.customize ["set", :id, "--nested-virt", "on"]
# .pvmp export is only supported with full clones
prl.linked_clone = false
end
# create new login user
config.vm.provision "shell", privileged: true, path: 'scripts/setup-vm-user.sh',
args: "user user"
# run the actual update-vm provisioning script under the new login user
config.vm.provision "shell", privileged: true, keep_color: true, run: "always", inline: <<-EOF
sudo -i -u user ROLE_TAGS=#{ENV['ROLE_TAGS']} /vagrant/scripts/update-vm.sh #{ENV['UPDATE_VM_FLAGS']}
EOF
end