-
Notifications
You must be signed in to change notification settings - Fork 8
/
Vagrantfile
234 lines (212 loc) · 11.7 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.ssh.forward_x11 = true
config.ssh.forward_agent = true
pahoehoe_network_name = "pahoehoe_#{SecureRandom.random_number(99999999)}"
config.vm.define "debian_build" do |debian_build|
debian_build.vm.box = "generic/debian10"
debian_build.vm.hostname = "debian-build"
debian_build.vm.boot_timeout = 1200
debian_build.vm.base_mac = "08002727A0A0"
debian_build.vm.synced_folder ".", "/vagrant", disabled: true
debian_build.vm.network "forwarded_port", guest: 22, host: 35000, id: "ssh", auto_correct: true
debian_build.vm.network :private_network, :ip => "192.168.221.50", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
# debian_build.vm.synced_folder "android/", "/home/vagrant/android/", create: true, disabled: false, type: "nfs", nfs_udp: false, nfs_version: "3", :mount_options => ['nolock,noatime,fsc,ac,actimeo=120,async,retrans=10']
# :mount_options => ['nolock,vers=3,tcp,noatime,fsc,actimeo=1,async']
debian_build.vm.provider :libvirt do |v, override|
v.default_prefix = "proxy_"
v.driver = "kvm"
v.nested = true
v.memory = 12384
v.cpus = 8
v.cputopology :sockets => "1", :cores => "4", :threads => "2"
if Vagrant.has_plugin?( "vagrant-libvirt", ">= 0.7.0" )
v.disk_bus = "scsi"
v.disk_driver :cache => "unsafe", :discard => "unmap", :detect_zeroes => "unmap", :io => "threads"
end
# v.channel :type => 'unix', :target_name => 'org.qemu.guest_agent.0', :disabled => false
# For libvirt plugin versions below 0.4.0.
# v.volume_cache = "unsafe"
# For libvirt plugin versions equal to, or higher than 0.4.0.
# v.disk_driver :cache => 'unsafe', :discard => 'unmap', :detect_zeroes => 'unmap'
end
debian_build.vm.provider :virtualbox do |v, override|
v.cpus = 4
v.memory = 4096
v.gui = false
v.customize ["modifyvm", :id, "--pagefusion", "on"]
# v.customize ["modifyvm", :id, "--guestmemoryballoon", 2048]
v.customize ["storagectl", :id, "--name", "SATA Controller", "--hostiocache", "on"]
v.customize ["setextradata", :id, "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled", 1]
end
debian_build.vm.provision "shell", inline: <<-SHELL
# set -x
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
cat <<-EOF | sudo debconf-set-selections
grub-pc grub-pc/install_devices_disks_changed string $(grub-probe --target=disk /boot)
grub-pc grub-pc/install_devices string $(grub-probe --target=disk /boot)
EOF
apt-get -qq update && apt-get -qq -y upgrade < /dev/null > /dev/null
apt-get -qq -y install xauth dbus-x11 < /dev/null > /dev/null
echo "* * * * * root command bash -c '/etc/cron.daily/mlocate'" > /etc/cron.d/updatedb
sudo sed -i 's/.*X11Forwarding.*/X11Forwarding yes/g' /etc/ssh/sshd_config
sudo sed -i 's/.*X11UseLocalhost.*/X11UseLocalhost no/g' /etc/ssh/sshd_config
sudo sed -i 's/.*X11DisplayOffset.*/X11DisplayOffset 10/g' /etc/ssh/sshd_config
sudo systemctl restart sshd.service
SHELL
end
# config.vm.define "ubuntu_aosp" do |debian_build|
# ubuntu_aosp.vm.box = "generic/ubuntu1804"
# ubuntu_aosp.vm.hostname = "ubuntu-aosp"
# ubuntu_aosp.vm.boot_timeout = 1200
# ubuntu_aosp.vm.base_mac = "08002727D0D0"
# ubuntu_aosp.vm.synced_folder ".", "/vagrant", disabled: true
# ubuntu_aosp.vm.network "forwarded_port", guest: 22, host: 34000, id: "ssh", auto_correct: true
# ubuntu_aosp.vm.network :private_network, :ip => "192.168.221.51", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
#
# ubuntu_aosp.vm.provider :libvirt do |v, override|
# v.default_prefix = "proxy_"
# v.driver = "kvm"
# v.nested = true
# v.memory = 12384
# v.cpus = 4
# v.cputopology :sockets => '1', :cores => '4', :threads => '2'
# if Vagrant.has_plugin?( "vagrant-libvirt", ">= 0.7.0" )
# v.disk_bus = "scsi"
# v.disk_driver :cache => "unsafe", :discard => "unmap", :detect_zeroes => "unmap", :io => "threads"
# end
# v.channel :type => 'unix', :target_name => 'org.qemu.guest_agent.0', :disabled => false
# # For libvirt plugin versions below 0.4.0.
# # v.volume_cache = "unsafe"
# # For libvirt plugin versions equal to, or higher than 0.4.0.
# v.disk_driver :cache => 'unsafe', :discard => 'unmap', :detect_zeroes => 'unmap'
# end
#
# ubuntu_aosp.vm.provider :virtualbox do |v, override|
# v.cpus = 4
# v.memory = 4096
# v.gui = false
# v.customize ["modifyvm", :id, "--pagefusion", "on"]
# v.customize ["storagectl", :id, "--name", "SATA Controller", "--hostiocache", "on"]
# v.customize ["setextradata", :id, "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled", 1]
# => end
#
# ubuntu_aosp.vm.provision "shell", inline: <<-SHELL
# # set -x
# export DEBIAN_FRONTEND=noninteractive
# export DEBCONF_NONINTERACTIVE_SEEN=true
# apt-get -qq update && apt-get -qq -y upgrade < /dev/null > /dev/null
# echo "* * * * * root command bash -c '/etc/cron.daily/mlocate'" > /etc/cron.d/updatedb
# sudo sed -i 's/.*X11Forwarding.*/X11Forwarding yes/g' /etc/ssh/sshd_config
# sudo sed -i 's/.*X11UseLocalhost.*/X11UseLocalhost no/g' /etc/ssh/sshd_config
# sudo sed -i 's/.*X11DisplayOffset.*/X11DisplayOffset 10/g' /etc/ssh/sshd_config
# sudo systemctl restart sshd.service
# SHELL
# end
config.vm.define "debian_vpn" do |debian_vpn|
debian_vpn.vm.box = "generic/debian10"
debian_vpn.vm.hostname = "debian-vpn"
debian_vpn.vm.boot_timeout = 1200
debian_vpn.vm.base_mac = "08002727B0B0"
debian_vpn.vm.synced_folder ".", "/vagrant", disabled: true
debian_vpn.vm.network "forwarded_port", guest: 22, host: 31000, id: "ssh", auto_correct: true
debian_vpn.vm.network :private_network, :ip => "192.168.221.142", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
debian_vpn.vm.network :private_network, :ip => "192.168.221.143", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
debian_vpn.vm.network :private_network, :ip => "192.168.221.144", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
debian_vpn.vm.network :private_network, :ip => "192.168.221.145", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
debian_vpn.vm.network :private_network, :ip => "192.168.221.146", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
debian_vpn.vm.provider :libvirt do |v, override|
v.driver = "kvm"
v.nested = true
v.memory = 1024
v.cpus = 1
v.default_prefix = "proxy_"
if Vagrant.has_plugin?( "vagrant-libvirt", ">= 0.7.0" )
v.disk_bus = "scsi"
v.disk_driver :cache => "unsafe", :discard => "unmap", :detect_zeroes => "unmap", :io => "threads"
end
# v.channel :type => 'unix', :target_name => 'org.qemu.guest_agent.0', :disabled => true
# For libvirt plugin versions below 0.4.0.
# v.volume_cache = "unsafe"
# For libvirt plugin versions equal to, or higher than 0.4.0.
# v.disk_driver :cache => 'unsafe', :discard => 'unmap', :detect_zeroes => 'unmap'
end
debian_vpn.vm.provider :virtualbox do |v, override|
v.cpus = 1
v.memory = 1024
v.gui = false
v.customize ["modifyvm", :id, "--pagefusion", "on"]
# v.customize ["modifyvm", :id, "--guestmemoryballoon", 512]
v.customize ["storagectl", :id, "--name", "SATA Controller", "--hostiocache", "on"]
v.customize ["setextradata", :id, "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled", 1]
end
debian_vpn.vm.provision "shell", inline: <<-SHELL
# set -x
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
cat <<-EOF | sudo debconf-set-selections
grub-pc grub-pc/install_devices_disks_changed string $(grub-probe --target=disk /boot)
grub-pc grub-pc/install_devices string $(grub-probe --target=disk /boot)
EOF
apt-get -qq update &> /dev/null && apt-get -qq -y upgrade < /dev/null > /dev/null
apt-get -qq -y install xauth dbus-x11 < /dev/null > /dev/null
echo "* * * * * root command bash -c '/etc/cron.daily/mlocate'" > /etc/cron.d/updatedb
sudo sed -i 's/.*X11Forwarding.*/X11Forwarding yes/g' /etc/ssh/sshd_config
sudo sed -i 's/.*X11UseLocalhost.*/X11UseLocalhost no/g' /etc/ssh/sshd_config
sudo sed -i 's/.*X11DisplayOffset.*/X11DisplayOffset 10/g' /etc/ssh/sshd_config
sudo systemctl restart sshd.service 2> /dev/null
SHELL
end
config.vm.define "alma_vpn" do |alma_vpn|
alma_vpn.vm.box = "generic/alma9"
alma_vpn.vm.hostname = "alma-vpn"
alma_vpn.vm.boot_timeout = 1200
alma_vpn.vm.base_mac = "08002727C0C0"
alma_vpn.vm.synced_folder ".", "/vagrant", disabled: true
alma_vpn.vm.network "forwarded_port", guest: 22, host: 30000, id: "ssh", auto_correct: true
alma_vpn.vm.network :private_network, :ip => "192.168.221.242", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
alma_vpn.vm.network :private_network, :ip => "192.168.221.243", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
alma_vpn.vm.network :private_network, :ip => "192.168.221.244", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
alma_vpn.vm.network :private_network, :ip => "192.168.221.245", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
alma_vpn.vm.network :private_network, :ip => "192.168.221.246", :libvirt__network_name => pahoehoe_network_name, :virtualbox__intnet => pahoehoe_network_name
alma_vpn.vm.provider :libvirt do |v, override|
v.driver = "kvm"
v.nested = true
v.memory = 1024
v.cpus = 1
v.default_prefix = "proxy_"
if Vagrant.has_plugin?( "vagrant-libvirt", ">= 0.7.0" )
v.disk_bus = "scsi"
v.disk_driver :cache => "unsafe", :discard => "unmap", :detect_zeroes => "unmap", :io => "threads"
end
# v.channel :type => 'unix', :target_name => 'org.qemu.guest_agent.0', :disabled => true
# For libvirt plugin versions below 0.4.0.
# v.volume_cache = "unsafe"
# For libvirt plugin versions equal to, or higher than 0.4.0.
# v.disk_driver :cache => 'unsafe', :discard => 'unmap', :detect_zeroes => 'unmap'
end
alma_vpn.vm.provider :virtualbox do |v, override|
v.cpus = 1
v.memory = 1024
v.gui = false
v.customize ["modifyvm", :id, "--pagefusion", "on"]
# v.customize ["modifyvm", :id, "--guestmemoryballoon", 512]
v.customize ["storagectl", :id, "--name", "SATA Controller", "--hostiocache", "on"]
v.customize ["setextradata", :id, "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled", 1]
end
alma_vpn.vm.provision "shell", inline: <<-SHELL
# set -x
dnf -q -y update 2> /dev/null
dnf -q -y install xauth dbus-x11 2> /dev/null
echo "* * * * * root command bash -c '/usr/bin/updatedb'" > /etc/cron.d/updatedb
sudo sed -i 's/.*X11Forwarding.*/X11Forwarding yes/g' /etc/ssh/sshd_config
sudo sed -i 's/.*X11UseLocalhost.*/X11UseLocalhost no/g' /etc/ssh/sshd_config
sudo sed -i 's/.*X11DisplayOffset.*/X11DisplayOffset 10/g' /etc/ssh/sshd_config
# We need to set the crypto policy to LEGACY for the CI server.
sudo update-crypto-policies --set LEGACY
sudo systemctl restart sshd.service 2> /dev/null
SHELL
end
end