forked from AlmaLinux/cloud-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.pkr.hcl
652 lines (511 loc) · 16.1 KB
/
variables.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
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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
variable "os_ver_8" {
description = "AlmaLinux OS 8 version"
type = string
default = "8.10"
validation {
condition = can(regex("8.[3-9]$|8.[1-9][0-9]$", var.os_ver_8))
error_message = "The os_ver_8 value must be one of released or prereleased versions of AlmaLinux OS 8."
}
}
variable "os_ver_9" {
description = "AlmaLinux OS 9 version"
type = string
default = "9.4"
validation {
condition = can(regex("9.[0-9]$|9.[1-9][0-9]$", var.os_ver_9))
error_message = "The os_ver_9 value must be one of released or prereleased versions of AlmaLinux OS 9."
}
}
locals {
os_ver_minor_8 = split(".", var.os_ver_8)[1]
os_ver_minor_9 = split(".", var.os_ver_9)[1]
}
locals {
iso_url_8_x86_64 = "https://repo.almalinux.org/almalinux/${var.os_ver_8}/isos/x86_64/AlmaLinux-${var.os_ver_8}-x86_64-boot.iso"
iso_checksum_8_x86_64 = "file:https://repo.almalinux.org/almalinux/${var.os_ver_8}/isos/x86_64/CHECKSUM"
iso_url_8_aarch64 = "https://repo.almalinux.org/almalinux/${var.os_ver_8}/isos/aarch64/AlmaLinux-${var.os_ver_8}-aarch64-boot.iso"
iso_checksum_8_aarch64 = "file:https://repo.almalinux.org/almalinux/${var.os_ver_8}/isos/aarch64/CHECKSUM"
iso_url_8_ppc64le = "https://repo.almalinux.org/almalinux/${var.os_ver_8}/isos/ppc64le/AlmaLinux-${var.os_ver_8}-ppc64le-boot.iso"
iso_checksum_8_ppc64le = "file:https://repo.almalinux.org/almalinux/${var.os_ver_8}/isos/ppc64le/CHECKSUM"
iso_url_9_x86_64 = "https://repo.almalinux.org/almalinux/${var.os_ver_9}/isos/x86_64/AlmaLinux-${var.os_ver_9}-x86_64-boot.iso"
iso_checksum_9_x86_64 = "file:https://repo.almalinux.org/almalinux/${var.os_ver_9}/isos/x86_64/CHECKSUM"
iso_url_9_aarch64 = "https://repo.almalinux.org/almalinux/${var.os_ver_9}/isos/aarch64/AlmaLinux-${var.os_ver_9}-aarch64-boot.iso"
iso_checksum_9_aarch64 = "file:https://repo.almalinux.org/almalinux/${var.os_ver_9}/isos/aarch64/CHECKSUM"
iso_url_9_ppc64le = "https://repo.almalinux.org/almalinux/${var.os_ver_9}/isos/ppc64le/AlmaLinux-${var.os_ver_9}-ppc64le-boot.iso"
iso_checksum_9_ppc64le = "file:https://repo.almalinux.org/almalinux/${var.os_ver_9}/isos/ppc64le/CHECKSUM"
}
# Common
variable "headless" {
description = "Disable GUI"
type = bool
default = true
}
variable "boot_wait" {
description = "Time to wait before typing boot command"
type = string
default = "10s"
}
variable "cpus" {
description = "The number of virtual cpus"
type = number
default = 2
}
variable "memory" {
description = "The amount of memory"
type = number
default = 2048
}
variable "post_cpus" {
description = "The number of virtual cpus after the build"
type = number
default = 1
}
variable "post_memory" {
description = "The number of virtual cpus after the build"
type = number
default = 1024
}
variable "http_directory" {
description = "Path to a directory to serve kickstart files"
type = string
default = "http"
}
variable "ssh_timeout" {
description = "The time to wait for SSH to become available"
type = string
default = "3600s"
}
variable "root_shutdown_command" {
description = "The command to use to gracefully shut down the machine"
type = string
default = "/sbin/shutdown -hP now"
}
variable "qemu_binary" {
description = "Path of QEMU binary"
type = string
default = null
}
variable "ovmf_code" {
description = "Path of OVMF code file"
type = string
default = "/usr/share/OVMF/OVMF_CODE.secboot.fd"
}
variable "ovmf_vars" {
description = "Path of OVMF variables file"
type = string
default = "/usr/share/OVMF/OVMF_VARS.secboot.fd"
}
variable "aavmf_code" {
description = "Path of AAVMF code file"
type = string
default = "/usr/share/AAVMF/AAVMF_CODE.fd"
}
# Generic Cloud (Cloud-init)
variable "gencloud_disk_size" {
description = "The size in GB of hard disk of VM"
type = string
default = "10G"
}
variable "gencloud_ssh_username" {
description = "The username to connect to SSH with"
type = string
default = "root"
}
variable "gencloud_ssh_password" {
description = "A plaintext password to use to authenticate with SSH"
type = string
default = "almalinux"
}
variable "gencloud_boot_wait_ppc64le" {
description = "Time to wait before typing boot command for ppc64le VM"
type = string
default = "8s"
}
variable "gencloud_boot_command_8_x86_64" {
description = "Boot command for x86_64 BIOS"
type = list(string)
default = [
"<tab>",
"inst.text net.ifnames=0 inst.gpt",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-8.gencloud-x86_64.ks",
"<enter><wait>"
]
}
local "gencloud_boot_command_8_x86_64_uefi" {
expression = [
"c<wait>",
"linuxefi",
" /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-8-${local.os_ver_minor_8}-x86_64-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-8.gencloud-x86_64.ks",
"<enter>",
"initrdefi /images/pxeboot/initrd.img",
"<enter>",
"boot<enter><wait>"
]
}
local "gencloud_boot_command_8_aarch64" {
expression = [
"c<wait>",
"linux /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-8-${local.os_ver_minor_8}-aarch64-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-8.gencloud-aarch64.ks",
"<enter>",
"initrd /images/pxeboot/initrd.img",
"<enter>",
"boot<enter><wait>"
]
}
local "gencloud_boot_command_8_ppc64le" {
expression = [
"c<wait>",
"linux /ppc/ppc64/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-8-${local.os_ver_minor_8}-ppc64le-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-8.gencloud-ppc64le.ks",
"<enter>",
"initrd /ppc/ppc64/initrd.img",
"<enter>",
"boot<enter><wait>"
]
}
variable "gencloud_boot_command_9_x86_64_bios" {
description = "Boot command for x86_64 BIOS"
type = list(string)
default = [
"<tab>",
"inst.text biosdevname=0 net.ifnames=0 inst.gpt",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-9.gencloud-x86_64-bios.ks",
"<enter><wait>"
]
}
local "gencloud_boot_command_9_x86_64" {
expression = [
"c<wait>",
"linuxefi /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-9-${local.os_ver_minor_9}-x86_64-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-9.gencloud-x86_64.ks",
"<enter>",
"initrdefi /images/pxeboot/initrd.img",
"<enter>",
"boot<enter><wait>"
]
}
local "gencloud_boot_command_9_aarch64" {
expression = [
"c<wait>",
"linux /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-9-${local.os_ver_minor_9}-aarch64-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-9.gencloud-aarch64.ks",
"<enter>",
"initrd /images/pxeboot/initrd.img<enter>",
"boot<enter><wait>"
]
}
local "gencloud_boot_command_9_ppc64le" {
expression = [
"c<wait>",
"linux /ppc/ppc64/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-9-${local.os_ver_minor_9}-ppc64le-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-9.gencloud-ppc64le.ks",
"<enter>",
"initrd /ppc/ppc64/initrd.img<enter>",
"boot<enter><wait>"
]
}
# Azure
variable "azure_disk_size" {
description = "The size in MiB of hard disk of VM"
type = number
default = 30720
}
local "azure_boot_command_8_x86_64" {
expression = [
"c<wait>",
"linuxefi /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-8-${local.os_ver_minor_8}-x86_64-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-8.azure-x86_64.ks",
"<enter>",
"initrdefi /images/pxeboot/initrd.img",
"<enter>",
"boot<enter><wait>"
]
}
local "azure_boot_command_9_x86_64" {
expression = [
"c<wait>",
"linuxefi /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-9-${local.os_ver_minor_9}-x86_64-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-9.azure-x86_64.ks",
"<enter>",
"initrdefi /images/pxeboot/initrd.img",
"<enter>",
"boot<enter><wait>"
]
}
# AWS
variable "aws_profile" {
description = "The profile to use in the shared credentials file for AWS"
default = null
}
variable "aws_ami_region" {
description = "The region to create the AMI"
type = string
default = "us-east-1"
}
variable "aws_ami_regions" {
description = "The list of regions to copy the AMI to"
type = list(string)
default = ["us-east-1"]
}
variable "aws_volume_type" {
description = "Volume type for AMI"
type = string
default = "gp3"
}
variable "aws_volume_size" {
description = "Volume size for AMI in GiB"
type = number
default = 4
}
variable "aws_instance_type_x86_64" {
description = "Instance type for builder. Only Nitro based is supported"
type = string
default = "t3.small"
}
variable "aws_instance_type_aarch64" {
description = "Instance type for builder. Only Nitro based is supported"
type = string
default = "t4g.small"
}
local "aws_ami_name_x86_64_8" {
expression = "AlmaLinux OS ${var.os_ver_8}.${formatdate("YYYYMMDD", timestamp())} x86_64"
}
local "aws_ami_name_aarch64_8" {
expression = "AlmaLinux OS ${var.os_ver_8}.${formatdate("YYYYMMDD", timestamp())} aarch64"
}
local "aws_ami_description_x86_64_8" {
expression = "Official AlmaLinux OS ${var.os_ver_8} x86_64 image"
}
local "aws_ami_description_aarch64_8" {
expression = "Official AlmaLinux OS ${var.os_ver_8} aarch64 image"
}
local "aws_ami_version_8" {
expression = "${var.os_ver_8}.${formatdate("YYYYMMDD", timestamp())}"
}
local "aws_ami_name_x86_64_9" {
expression = "AlmaLinux OS ${var.os_ver_9}.${formatdate("YYYYMMDD", timestamp())} x86_64"
}
local "aws_ami_name_aarch64_9" {
expression = "AlmaLinux OS ${var.os_ver_9}.${formatdate("YYYYMMDD", timestamp())} aarch64"
}
local "aws_ami_description_x86_64_9" {
expression = "Official AlmaLinux OS ${var.os_ver_9} x86_64 image"
}
local "aws_ami_description_aarch64_9" {
expression = "Official AlmaLinux OS ${var.os_ver_9} aarch64 image"
}
local "aws_ami_version_9" {
expression = "${var.os_ver_9}.${formatdate("YYYYMMDD", timestamp())}"
}
variable "aws_source_ami_8_x86_64" {
description = "AlmaLinux OS 8 x86_64 AMI as source"
type = string
default = "ami-0f384fefb431fbea2"
}
variable "aws_source_ami_8_aarch64" {
description = "AlmaLinux OS 8 AArch64 AMI as source"
type = string
default = "ami-099b4f20875da4c84"
}
variable "aws_source_ami_9_x86_64" {
description = "AlmaLinux OS 9 x86_64 AMI as source"
type = string
default = "ami-09ec283e9acdfa57e"
}
variable "aws_source_ami_9_aarch64" {
description = "AlmaLinux OS 9 AArch64 AMI as source"
type = string
default = "ami-01b09fbeec4dbcc45"
}
# Vagrant
variable "vagrant_disk_size" {
description = "The size in MiB of hard disk of VM"
type = number
default = 20000
}
variable "vagrant_shutdown_command" {
description = "The command to use to gracefully shut down the machine"
type = string
default = "echo vagrant | sudo -S /sbin/shutdown -hP now"
}
variable "vagrant_ssh_username" {
description = "The username to connect to SSH with"
type = string
default = "vagrant"
}
variable "vagrant_ssh_password" {
description = "A plaintext password to use to authenticate with SSH"
type = string
default = "vagrant"
}
variable "vagrant_boot_command_8_x86_64" {
description = "Boot command for x86_64 BIOS"
type = list(string)
default = [
"<tab>",
" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-8.vagrant.ks",
"<enter><wait>"
]
}
local "vagrant_boot_command_8_x86_64_uefi" {
expression = [
"c<wait>",
"linuxefi /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-8-${local.os_ver_minor_8}-x86_64-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-8.vagrant.ks",
"<enter>",
"initrdefi /images/pxeboot/initrd.img<enter>",
"boot<enter><wait>"
]
}
local "vagrant_boot_command_9_x86_64" {
expression = [
"c",
"<wait>",
"linuxefi /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-9-${local.os_ver_minor_9}-x86_64-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-9.vagrant-x86_64.ks",
"<enter>",
"initrdefi /images/pxeboot/initrd.img",
"<enter>",
"boot<enter><wait>"
]
}
variable "vagrant_boot_command_9_x86_64_bios" {
description = "Boot command for x86_64 BIOS"
type = list(string)
default = [
"<tab>",
"inst.text inst.gpt inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-9.vagrant-x86_64.ks",
"<enter><wait>"
]
}
variable "vagrant_boot_command_9_aarch64" {
description = "Boot command for AArch64"
type = list(string)
default = [
"e",
"<down><down><end><bs><bs><bs><bs><bs>",
"inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-9.vagrant-aarch64.ks",
"<leftCtrlOn>x<leftCtrlOff>"
]
}
# OpenNebula
variable "opennebula_boot_command_8_x86_64" {
description = "Boot command for x86_64 BIOS"
type = list(string)
default = [
"<tab>",
" inst.text net.ifnames=0 inst.gpt inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-8.opennebula-x86_64.ks",
"<enter><wait>"
]
}
local "opennebula_boot_command_8_aarch64" {
expression = [
"c",
"<wait>",
"linux /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=AlmaLinux-8-${local.os_ver_minor_8}-aarch64-dvd ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/almalinux-8.opennebula-aarch64.ks",
"<enter>",
"initrd /images/pxeboot/initrd.img",
"<enter>",
"boot<enter><wait>"
]
}
# Hyper-V
variable "hyperv_switch_name" {
description = "The name of the switch to connect the virtual machine to"
type = string
default = null
}
# Parallels
variable "parallels_tools_flavor_x86_64" {
description = "The flavor of the Parallels Tools ISO to install into the x86_64 VM"
type = string
default = "lin"
}
variable "parallels_tools_flavor_aarch64" {
description = "The flavor of the Parallels Tools ISO to install into the AArch64 VM"
type = string
default = "lin-arm"
}
# DigitalOcean
variable "do_api_token" {
description = "A personal access token used to communicate with the DigitalOcean v2 API"
sensitive = true
type = string
default = null
}
variable "do_spaces_key" {
description = "The access key used to communicate with Spaces"
sensitive = true
type = string
default = null
}
variable "do_spaces_secret" {
description = "The secret key used to communicate with Spaces"
sensitive = true
type = string
default = null
}
variable "do_spaces_region" {
description = "The name of the region, such as nyc3, in which to upload the image to Spaces"
sensitive = true
type = string
default = null
}
variable "do_space_name" {
description = "The name of the specific Space where the image file will be copied to for import"
type = string
default = null
}
variable "do_image_name_8" {
description = "The name to be used for the resulting DigitalOcean custom image"
type = string
default = null
}
variable "do_image_name_9" {
description = "The name to be used for the resulting DigitalOcean custom image"
type = string
default = null
}
variable "do_image_regions" {
description = "A list of DigitalOcean regions"
type = list(string)
default = null
}
variable "do_image_description" {
description = "The description to set for the resulting imported image"
type = string
default = "Official AlmaLinux OS Image"
}
variable "do_image_distribution" {
description = "The name of the distribution to set for the resulting imported image"
type = string
default = "AlmaLinux OS"
}
local "do_image_tags" {
expression = ["AlmaLinux", "${var.os_ver_8}", "8"]
}