-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile.x86
executable file
·347 lines (327 loc) · 12.8 KB
/
Vagrantfile.x86
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Vagrantfile for ansible-common-role
# 2207.23 added alma9 and rocky9
# 2303.04 added fedora37
# 2304.21 added fedora38, removed fedora33-35
# 2305.06 vagrantup.com SSL cert expired on 10.13; installing vagrant 2.3.0 gives warning because cert expired
# 2307.04 added debian 12; vagrant 2.3.4 works on catalina but stand-alone version more current
# 2404.30 removed older suse & fedora boxes; added fedora-39,40
# 2405.27 removed fedora 39; there's no box for it yet
# 2407.05 added fedora 39+40;
Vagrant.configure("2") do |config|
# config.vm.network 'forwarded_port', guest: 80, host: 8080
config.vm.box_download_insecure = true
config.vm.provider "virtualbox"
config.vm.synced_folder '.', '/vagrant', disabled: true
config.ssh.insert_key = false
config.vm.boot_timeout = 120
config.vm.provider :virtualbox do |vb|
#vb.gui = true
vb.memory = '1024'
end
# provision on all machines to allow ssh w/o checking
config.vm.provision "shell", inline: <<-SHELLALL
echo "...disabling CheckHostIP..."
sed -i.orig -e "s/# CheckHostIP yes/CheckHostIP no/" /etc/ssh/ssh_config
sed -i -e "s/.*PermitRootLogin.*/PermitRootLogin yes/" /etc/ssh/ssh_config
# for i in /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-enp0s8; do
# if [ -e ${i} ]; then echo "...displaying ${i}..."; cat ${i}; fi
# done
SHELLALL
config.vm.define "a2" do |a2|
a2.vm.box = "bento/amazonlinux-2"
a2.ssh.insert_key = false
a2.vm.network 'private_network', ip: '10.1.100.190'
a2.vm.hostname = 'a2.test'
a2.vm.provision "shell", inline: <<-SHELL
amazon-linux-extras install epel #ansible2=2.8 kernel-ng python3.8
yum-config-manager --enable epel
# alternatives --set python /usr/bin/python3.8
# python3.8 -m pip install --upgrade pip setuptools
SHELL
a2.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
# ansible.verbose = "v"
# ansible.raw_arguments = [""]
end
end
config.vm.define "a8" do |a8|
a8.vm.box = "almalinux/8"
a8.ssh.insert_key = false
a8.vm.network 'private_network', ip: '10.1.100.188'
a8.vm.hostname = 'a8.test'
a8.vm.provision "shell", inline: <<-SHELL
dnf install -y epel-release python3
dnf config-manager --set-enabled powertools
dnf makecache
# dnf install -y ansible
alternatives --set python /usr/bin/python3
SHELL
a8.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
# ansible.verbose = "v"
# ansible.raw_arguments = [""]
end
end
config.vm.define "a9" do |a9|
a9.vm.box = "almalinux/9"
a9.ssh.insert_key = false
a9.vm.network 'private_network', ip: '10.1.100.189'
a9.vm.hostname = 'a9.test'
a9.vm.provision "shell", inline: <<-SHELL
dnf install -y epel-release python3
dnf makecache
SHELL
a9.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
# ansible.verbose = "v"
# ansible.raw_arguments = [""]
end
end
# centos6 will fail in ansible 2.13 as python=2.6.6 is to old
# and epel-release version of python3.4 is also to old
config.vm.define "c7" do |c7|
c7.vm.box = "centos/7"
c7.ssh.insert_key = false
c7.vm.network 'private_network', ip: '10.1.100.107'
c7.vm.hostname = 'c7.test'
c7.vm.provision "shell", inline: <<-SHELL
yum install -y python libselinux-python
SHELL
c7.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
# 6/12/21 centos/8 and almalinux/8 stopped being able to auth w/ insecure private key
# so switch to bento's release
# https://bugzilla.redhat.com/show_bug.cgi?id=1820925
# 6/14/21 https://github.com/hashicorp/vagrant/issues/8204 export SSH_AUTH_SOCK=""
# 2/24/22 centos/8 and bento/centos-8.5 yum's repos don't work any more...use latest rockylinux
# Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
# 6/16/24 rockylinux 8.9
config.vm.define "r8" do |r8|
r8.vm.box = "generic/rocky8"
r8.ssh.insert_key = false
r8.vm.network 'private_network', ip: '10.1.100.198'
r8.vm.hostname = 'r8.test'
r8.vm.provision "shell", inline: <<-SHELL
dnf install -y epel-release python3
dnf config-manager --set-enabled powertools
dnf makecache
# dnf install -y ansible
alternatives --set python /usr/bin/python3
SHELL
r8.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
# ansible.verbose = "v"
# ansible.raw_arguments = [""]
end
end
# 11/2/24 removed rockylinux9.4 as it's the same release as almalinux9.4
# 7/30/23 no more security patches or releases file; removed
# config.vm.define "d9" do |d9|
# don't use apt: update_cache=yes here because it won't work to trap
# repo change errors like with Debian 10 because of apt-secure server
# 6/14/21 https://github.com/hashicorp/vagrant/issues/8204 export SSH_AUTH_SOCK=""
config.vm.define "d10" do |d10|
d10.vm.box = "debian/buster64"
d10.ssh.insert_key = false
d10.vm.network 'private_network', ip: '10.1.100.210'
d10.vm.hostname = 'd10.test' # won't set domain
d10.vm.provision "shell", inline: <<-SHELL
apt-get update --allow-releaseinfo-change -y
apt-get install -y apt-transport-https
SHELL
d10.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
config.vm.define "d11" do |d11|
d11.vm.box = "debian/bullseye64"
d11.ssh.insert_key = false
d11.vm.network 'private_network', ip: '10.1.100.211'
d11.vm.hostname = 'd11.test' # won't set domain
d11.vm.provision "shell", inline: <<-SHELL
apt-get update --allow-releaseinfo-change -y
apt-get install -y apt-transport-https
SHELL
d11.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
config.vm.define "d12" do |d12|
d12.vm.box = "debian/bookworm64"
d12.ssh.insert_key = false
d12.vm.network 'private_network', ip: '10.1.100.212'
d12.vm.hostname = 'd12.test' # won't set domain
d12.vm.provision "shell", inline: <<-SHELL
apt-get update --allow-releaseinfo-change -y
apt-get install -y apt-transport-https
SHELL
d12.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
# fedora-21 vagrant box doesn't set 2nd network config correctly
# fedora 21 doesn't install sudo
config.vm.define "f21" do |f21|
f21.vm.box = "bento/fedora-21"
f21.ssh.insert_key = false
f21.vm.network 'private_network', ip: '10.1.100.221'
f21.vm.hostname = 'f21.test'
f21.vm.provision "shell", inline: <<-SHELL
echo "...installing python (this may take a while)..."
yum install -y sudo python libselinux-python python3
echo "...fixing enp0s8..."
sed -i -e "s/BOOTPROTO=none/BOOTPROTO=static/" /etc/sysconfig/network-scripts/ifcfg-enp0s8
echo "...restarting network..."
systemctl restart network
sleep 10
systemctl restart network
ip addr
SHELL
f21.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
# 8/10/22 fedora36 doesn't use legacy /etc/sysconfig/network-scripts/ifcfg-eth1 scripts
# https://github.com/hashicorp/vagrant/issues/12762
# 9/9/22 have to use nmcli manually for eth1 until vagrant fixes this
config.vm.define "f38" do |f38|
f38.vm.box = "fedora/38-cloud-base"
f38.ssh.insert_key = false
f38.vm.network 'private_network', ip: '10.1.100.238'
f38.vm.hostname = 'f38.test'
f38.vm.provision "shell", inline: <<-SHELL
dnf config-manager --setopt=fastestmirror=True --save
# dnf config-manager --add-repo https://dl.fedoraproject.org/pub/fedora/linux/releases/38/Everything/x86_64/os/
# dnf config-manager --add-repo http://mirrors.kernel.org/fedora/releases/38/Everything/x86_64/os/
# dnf install -y python3
# dnf install -y NetworkManager-initscripts-ifcfg-rh
nmcli device modify eth1 ipv4.method manual ipv4.addr 10.1.100.238/24
ip addr
SHELL
f38.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
config.vm.define "f39" do |f39|
f39.vm.box = "bento/fedora-39"
f39.ssh.insert_key = false
f39.vm.network 'private_network', ip: '10.1.100.239'
f39.vm.hostname = 'f39.test'
f39.vm.provision "shell", inline: <<-SHELL
dnf config-manager --setopt=fastestmirror=True --save
dnf config-manager --add-repo http://mirrors.kernel.org/fedora/releases/39/Everything/x86_64/os/
dnf install -y python3 python3-libselinux
# dnf install -y NetworkManager-initscripts-ifcfg-rh
nmcli device modify eth1 ipv4.method manual ipv4.addr 10.1.100.239/24
ip addr
SHELL
f39.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
config.vm.define "f40" do |f40|
f40.vm.box = "bento/fedora-40"
f40.ssh.insert_key = false
f40.vm.network 'private_network', ip: '10.1.100.240'
f40.vm.hostname = 'f40.test'
f40.vm.provision "shell", inline: <<-SHELL
dnf config-manager --setopt=fastestmirror=True --save
dnf config-manager --add-repo http://mirrors.kernel.org/fedora/releases/40/Everything/x86_64/os/
dnf install -y python3 python3-libselinux
# dnf install -y NetworkManager-initscripts-ifcfg-rh
nmcli device modify eth1 ipv4.method manual ipv4.addr 10.1.100.240/24
ip addr
SHELL
f40.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
# ansible uses python3 1/7/21
config.vm.define "u18" do |u18|
u18.vm.box = "ubuntu/bionic64"
u18.vm.network 'private_network', ip: '10.1.100.118'
u18.vm.hostname = 'u18.test' # won't set domain
u18.vm.provision "shell", inline: <<-SHELL
apt-get -y install python3
SHELL
u18.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
# https://www.reddit.com/r/Ubuntu/comments/ga187h/focal64_vagrant_box_issues/
# 1/7/21 earlier releases of focal64 didn't work with vagrant but that's now been fixed
# requires setting ansible_python_interpreter=/usr/bin/python3
config.vm.define "u20" do |u20|
u20.vm.box = "ubuntu/focal64"
#u20.vm.box = "bento/ubuntu-20.04"
u20.vm.network 'private_network', ip: '10.1.100.120'
u20.vm.hostname = 'u20.test' # won't set domain
u20.vm.provision "shell", inline: <<-SHELL
apt-get -y install python3
SHELL
u20.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
config.vm.define "u22" do |u22|
u22.vm.box = "ubuntu/jammy64"
u22.vm.network 'private_network', ip: '10.1.100.122'
u22.vm.hostname = 'u22.test' # won't set domain
u22.vm.provision "shell", inline: <<-SHELL
apt-get -y update
apt-get -y install python3
SHELL
u22.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
config.vm.define "u24" do |u24|
u24.vm.box = "alvistack/ubuntu-24.04"
u24.vm.network 'private_network', ip: '10.1.100.124'
u24.vm.hostname = 'u24.test' # won't set domain
u24.vm.provision "shell", inline: <<-SHELL
apt-get -y update
apt-get -y install python3
SHELL
u24.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
ansible.inventory_path = "./inventory"
end
end
end