-
Notifications
You must be signed in to change notification settings - Fork 48
/
almalinux-9-vagrant.pkr.hcl
287 lines (271 loc) · 10.5 KB
/
almalinux-9-vagrant.pkr.hcl
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
# AlmaLinux OS 9 Packer template for Vagrant boxes
source "qemu" "almalinux-9" {
iso_url = local.iso_url_9_x86_64
iso_checksum = local.iso_checksum_9_x86_64
http_directory = var.http_directory
shutdown_command = var.vagrant_shutdown_command
ssh_username = var.vagrant_ssh_username
ssh_password = var.vagrant_ssh_password
ssh_timeout = var.ssh_timeout
boot_command = local.vagrant_boot_command_9_x86_64
boot_wait = var.boot_wait
accelerator = "kvm"
disk_interface = "virtio-scsi"
disk_size = var.vagrant_disk_size
disk_cache = "unsafe"
disk_discard = "unmap"
disk_detect_zeroes = "unmap"
disk_compression = true
format = "qcow2"
headless = var.headless
machine_type = "q35"
memory = var.memory
net_device = "virtio-net"
qemu_binary = var.qemu_binary
vm_name = "AlmaLinux-9-Vagrant-Libvirt-${var.os_ver_9}-${formatdate("YYYYMMDD", timestamp())}.x86_64.qcow2"
cpu_model = "host"
cpus = var.cpus
efi_boot = true
efi_firmware_code = var.ovmf_code
efi_firmware_vars = var.ovmf_vars
efi_drop_efivars = true
}
source "virtualbox-iso" "almalinux-9" {
iso_url = local.iso_url_9_x86_64
iso_checksum = local.iso_checksum_9_x86_64
http_directory = var.http_directory
shutdown_command = var.vagrant_shutdown_command
ssh_username = var.vagrant_ssh_username
ssh_password = var.vagrant_ssh_password
ssh_timeout = var.ssh_timeout
boot_command = local.vagrant_boot_command_9_x86_64
boot_wait = var.boot_wait
firmware = "efi"
disk_size = var.vagrant_disk_size
guest_os_type = "RedHat_64"
cpus = var.cpus
memory = var.memory
headless = var.headless
hard_drive_interface = "sata"
iso_interface = "sata"
vboxmanage = [["modifyvm", "{{.Name}}", "--nat-localhostreachable1", "on"]]
vboxmanage_post = [
["modifyvm", "{{.Name}}", "--memory", var.post_memory],
["modifyvm", "{{.Name}}", "--cpus", var.post_cpus],
]
}
source "hyperv-iso" "almalinux-9" {
iso_url = local.iso_url_9_x86_64
iso_checksum = local.iso_checksum_9_x86_64
http_directory = var.http_directory
shutdown_command = var.vagrant_shutdown_command
communicator = "ssh"
ssh_username = var.vagrant_ssh_username
ssh_password = var.vagrant_ssh_password
ssh_timeout = var.ssh_timeout
boot_command = local.vagrant_boot_command_9_x86_64
boot_wait = var.boot_wait
disk_size = var.vagrant_disk_size
disk_block_size = 1
memory = var.memory
switch_name = var.hyperv_switch_name
cpus = var.cpus
generation = 2
enable_dynamic_memory = true
headless = var.headless
}
source "vmware-iso" "almalinux-9" {
iso_url = local.iso_url_9_x86_64
iso_checksum = local.iso_checksum_9_x86_64
http_directory = var.http_directory
shutdown_command = var.vagrant_shutdown_command
ssh_username = var.vagrant_ssh_username
ssh_password = var.vagrant_ssh_password
ssh_timeout = var.ssh_timeout
boot_command = var.vagrant_boot_command_9_x86_64_bios
boot_wait = var.boot_wait
disk_size = var.vagrant_disk_size
guest_os_type = "centos-64"
cpus = var.cpus
memory = var.memory
headless = var.headless
vmx_remove_ethernet_interfaces = true
vmx_data = {
"cpuid.coresPerSocket" = "1"
}
vmx_data_post = {
"memsize" = var.post_memory
"numvcpus" = var.post_cpus
}
}
source "parallels-iso" "almalinux-9" {
iso_url = local.iso_url_9_x86_64
iso_checksum = local.iso_checksum_9_x86_64
http_directory = var.http_directory
shutdown_command = var.vagrant_shutdown_command
ssh_username = var.vagrant_ssh_username
ssh_password = var.vagrant_ssh_password
ssh_timeout = var.ssh_timeout
boot_command = var.vagrant_boot_command_9_x86_64_bios
boot_wait = var.boot_wait
cpus = var.cpus
disk_size = var.vagrant_disk_size
guest_os_type = "centos"
memory = var.memory
parallels_tools_flavor = var.parallels_tools_flavor_x86_64
}
source "vmware-iso" "almalinux-9-aarch64" {
iso_url = local.iso_url_9_aarch64
iso_checksum = local.iso_checksum_9_aarch64
http_directory = var.http_directory
shutdown_command = var.vagrant_shutdown_command
ssh_username = var.vagrant_ssh_username
ssh_password = var.vagrant_ssh_password
ssh_timeout = var.ssh_timeout
boot_command = var.vagrant_boot_command_9_aarch64
boot_wait = var.boot_wait
disk_size = var.vagrant_disk_size
guest_os_type = "arm-rhel9-64"
cpus = var.cpus
memory = var.memory
headless = var.headless
vmx_remove_ethernet_interfaces = true
vm_name = "almalinux-9"
usb = true
disk_adapter_type = "nvme"
vmx_data = {
".encoding" = "UTF-8"
"config.version" = "8"
"virtualHW.version" = "20"
"usb_xhci.present" = "true"
"ethernet0.virtualdev" = "e1000e"
"firmware" = "efi"
}
}
source "parallels-iso" "almalinux-9-aarch64" {
iso_url = local.iso_url_9_aarch64
iso_checksum = local.iso_checksum_9_aarch64
http_directory = var.http_directory
shutdown_command = var.vagrant_shutdown_command
ssh_username = var.vagrant_ssh_username
ssh_password = var.vagrant_ssh_password
ssh_timeout = var.ssh_timeout
boot_command = var.vagrant_boot_command_9_aarch64
boot_wait = var.boot_wait
cpus = var.cpus
disk_size = var.vagrant_disk_size
guest_os_type = "centos"
memory = var.memory
parallels_tools_flavor = var.parallels_tools_flavor_aarch64
}
source "virtualbox-iso" "almalinux-9-aarch64" {
iso_url = local.iso_url_9_aarch64
iso_checksum = local.iso_checksum_9_aarch64
http_directory = var.http_directory
shutdown_command = var.vagrant_shutdown_command
ssh_username = var.vagrant_ssh_username
ssh_password = var.vagrant_ssh_password
ssh_timeout = var.ssh_timeout
boot_command = var.vagrant_boot_command_9_aarch64
boot_wait = var.boot_wait
disk_size = var.vagrant_disk_size
guest_os_type = "RedHat_64"
cpus = var.cpus
memory = var.memory
headless = var.headless
hard_drive_interface = "sata"
vboxmanage = [["modifyvm", "{{.Name}}", "--nat-localhostreachable1", "on"]]
vboxmanage_post = [
["modifyvm", "{{.Name}}", "--memory", var.post_memory],
["modifyvm", "{{.Name}}", "--cpus", var.post_cpus],
]
}
build {
sources = [
"source.qemu.almalinux-9",
"source.virtualbox-iso.almalinux-9",
"source.hyperv-iso.almalinux-9",
"source.vmware-iso.almalinux-9",
"source.parallels-iso.almalinux-9",
"source.virtualbox-iso.almalinux-9-aarch64",
"source.vmware-iso.almalinux-9-aarch64",
"source.parallels-iso.almalinux-9-aarch64",
]
provisioner "ansible" {
galaxy_file = "./ansible/requirements.yml"
galaxy_force_install = true
collections_path = "./ansible/collections"
roles_path = "./ansible/roles"
playbook_file = "./ansible/vagrant-box.yml"
ansible_env_vars = [
"ANSIBLE_PIPELINING=True",
"ANSIBLE_REMOTE_TEMP=/tmp",
"ANSIBLE_SCP_EXTRA_ARGS=-O",
]
extra_arguments = [
"--extra-vars",
"packer_provider=${source.type}",
]
only = [
"qemu.almalinux-9",
"virtualbox-iso.almalinux-9",
"vmware-iso.almalinux-9",
"parallels-iso.almalinux-9",
"virtualbox-iso.almalinux-9-aarch64",
"vmware-iso.almalinux-9-aarch64",
"parallels-iso.almalinux-9-aarch64",
]
}
provisioner "ansible" {
user = "vagrant"
use_proxy = false
galaxy_file = "./ansible/requirements.yml"
galaxy_force_install = true
collections_path = "./ansible/collections"
roles_path = "./ansible/roles"
playbook_file = "./ansible/vagrant-box.yml"
ansible_env_vars = [
"ANSIBLE_PIPELINING=True",
"ANSIBLE_REMOTE_TEMP=/tmp",
"ANSIBLE_SCP_EXTRA_ARGS=-O",
"ANSIBLE_HOST_KEY_CHECKING=False",
]
extra_arguments = [
"--extra-vars",
"packer_provider=${source.type} ansible_ssh_pass=vagrant",
]
only = ["hyperv-iso.almalinux-9"]
}
provisioner "shell" {
expect_disconnect = true
inline = ["sudo rm -fr /etc/ssh/*host*key*"]
only = ["hyperv-iso.almalinux-9"]
}
post-processors {
post-processor "vagrant" {
compression_level = "9"
output = "AlmaLinux-9-Vagrant-{{.Provider}}-${var.os_ver_9}-${formatdate("YYYYMMDD", timestamp())}.x86_64.box"
only = [
"virtualbox-iso.almalinux-9",
"hyperv-iso.almalinux-9",
"vmware-iso.almalinux-9",
"parallels-iso.almalinux-9",
]
}
post-processor "vagrant" {
compression_level = "9"
output = "AlmaLinux-9-Vagrant-{{.Provider}}-${var.os_ver_9}-${formatdate("YYYYMMDD", timestamp())}.aarch64.box"
only = [
"virtualbox-iso.almalinux-9-aarch64",
"vmware-iso.almalinux-9-aarch64",
"parallels-iso.almalinux-9-aarch64",
]
}
post-processor "vagrant" {
compression_level = "9"
vagrantfile_template = "tpl/vagrant/vagrantfile-libvirt.rb"
output = "AlmaLinux-9-Vagrant-{{.Provider}}-${var.os_ver_9}-${formatdate("YYYYMMDD", timestamp())}.x86_64.box"
only = ["qemu.almalinux-9"]
}
}
}