-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathalmalinux-8-vagrant.pkr.hcl
More file actions
307 lines (288 loc) · 10.7 KB
/
Copy pathalmalinux-8-vagrant.pkr.hcl
File metadata and controls
307 lines (288 loc) · 10.7 KB
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
# AlmaLinux OS 8 Packer template for Vagrant boxes
source "qemu" "almalinux-8" {
iso_url = local.iso_url_8_x86_64
iso_checksum = local.iso_checksum_8_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_8_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_x86_64
net_device = "virtio-net"
qemu_binary = var.qemu_binary
vm_name = "AlmaLinux-8-Vagrant-Libvirt-${var.os_ver_8}-${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-8" {
iso_url = local.iso_url_8_x86_64
iso_checksum = local.iso_checksum_8_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_8_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_x86_64
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-8" {
iso_url = local.iso_url_8_x86_64
iso_checksum = local.iso_checksum_8_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_8_x86_64
boot_wait = var.boot_wait
disk_size = var.vagrant_disk_size
disk_block_size = 1
memory = var.memory_x86_64
switch_name = var.hyperv_switch_name
cpus = var.cpus
generation = 2
enable_dynamic_memory = true
headless = var.headless
}
source "qemu" "almalinux-8-hyperv-x86_64" {
iso_url = local.iso_url_8_x86_64
iso_checksum = local.iso_checksum_8_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.hyperv_boot_command_8_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"
format = "raw"
headless = var.headless
machine_type = "q35"
memory = var.memory_x86_64
net_device = "virtio-net"
qemu_binary = var.qemu_binary
vm_name = "almalinux-8-hyperv-x86_64.raw"
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 "vmware-iso" "almalinux-8" {
iso_url = local.iso_url_8_x86_64
iso_checksum = local.iso_checksum_8_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_8_x86_64
boot_wait = var.boot_wait
disk_size = var.vagrant_disk_size
guest_os_type = "centos-64"
version = 21
vm_name = "AlmaLinux-8-Vagrant-VMware-${var.os_ver_8}-${formatdate("YYYYMMDD", timestamp())}.x86_64"
firmware = "efi"
cpus = var.cpus
memory = var.memory_x86_64
network_adapter_type = "vmxnet3"
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-8" {
iso_url = local.iso_url_8_x86_64
iso_checksum = local.iso_checksum_8_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_8_x86_64_bios
boot_wait = var.boot_wait
cpus = var.cpus
disk_size = var.vagrant_disk_size
guest_os_type = "centos"
memory = var.memory_x86_64
parallels_tools_flavor = var.parallels_tools_flavor_x86_64
}
build {
sources = [
"source.qemu.almalinux-8",
"source.virtualbox-iso.almalinux-8",
"source.hyperv-iso.almalinux-8",
"source.qemu.almalinux-8-hyperv-x86_64",
"source.vmware-iso.almalinux-8",
"source.parallels-iso.almalinux-8",
]
provisioner "ansible" {
user = "vagrant"
galaxy_file = "./ansible/requirements.yml"
galaxy_force_install = true
collections_path = "./ansible/collections"
roles_path = "./ansible/roles"
playbook_file = "./ansible/vagrant.yml"
ansible_env_vars = [
"ANSIBLE_PIPELINING=True",
"ANSIBLE_REMOTE_TEMP=/tmp",
"ANSIBLE_SSH_TRANSFER_METHOD=scp",
"ANSIBLE_SCP_EXTRA_ARGS=-O",
]
extra_arguments = [
"--extra-vars",
"packer_provider=${source.type} is_unified_boot=true",
]
only = [
"qemu.almalinux-8",
"virtualbox-iso.almalinux-8",
"vmware-iso.almalinux-8",
]
}
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.yml"
ansible_env_vars = [
"ANSIBLE_PIPELINING=True",
"ANSIBLE_REMOTE_TEMP=/tmp",
"ANSIBLE_SSH_TRANSFER_METHOD=scp",
"ANSIBLE_SCP_EXTRA_ARGS=-O",
"ANSIBLE_HOST_KEY_CHECKING=False",
]
extra_arguments = [
"--extra-vars",
"packer_provider=${source.type} ansible_ssh_pass=vagrant is_unified_boot=true",
]
only = ["hyperv-iso.almalinux-8"]
}
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/hyperv.yml"
ansible_env_vars = [
"ANSIBLE_PIPELINING=True",
"ANSIBLE_REMOTE_TEMP=/tmp",
"ANSIBLE_SSH_TRANSFER_METHOD=scp",
"ANSIBLE_SCP_EXTRA_ARGS=-O",
"ANSIBLE_HOST_KEY_CHECKING=False",
]
extra_arguments = [
"--extra-vars",
"packer_provider=${source.type} ansible_ssh_pass=vagrant is_unified_boot=true",
]
only = ["qemu.almalinux-8-hyperv-x86_64"]
}
provisioner "shell" {
expect_disconnect = true
inline = ["sudo rm -fr /etc/ssh/*host*key*"]
only = [
"hyperv-iso.almalinux-8",
"qemu.almalinux-8-hyperv-x86_64",
]
}
provisioner "ansible" {
galaxy_file = "./ansible/requirements.yml"
galaxy_force_install = true
collections_path = "./ansible/collections"
roles_path = "./ansible/roles"
playbook_file = "./ansible/vagrant.yml"
ansible_env_vars = [
"ANSIBLE_PIPELINING=True",
"ANSIBLE_REMOTE_TEMP=/tmp",
"ANSIBLE_SSH_TRANSFER_METHOD=scp",
"ANSIBLE_SCP_EXTRA_ARGS=-O",
]
extra_arguments = [
"--extra-vars",
"packer_provider=${source.type}",
]
only = ["parallels-iso.almalinux-8"]
}
post-processors {
post-processor "vagrant" {
compression_level = "9"
vagrantfile_template = "tpl/vagrant/vagrantfile-libvirt.rb"
output = "AlmaLinux-8-Vagrant-${var.os_ver_8}-${formatdate("YYYYMMDD", timestamp())}.x86_64.{{.Provider}}.box"
only = ["qemu.almalinux-8"]
}
post-processor "vagrant" {
compression_level = "9"
output = "AlmaLinux-8-Vagrant-${var.os_ver_8}-${formatdate("YYYYMMDD", timestamp())}.x86_64.{{.Provider}}.box"
only = [
"virtualbox-iso.almalinux-8",
"hyperv-iso.almalinux-8",
"vmware-iso.almalinux-8",
"parallels-iso.almalinux-8",
]
}
post-processor "shell-local" {
inline = [
"tools/fix-vagrant-virtualbox-ovf.sh AlmaLinux-8-Vagrant-${var.os_ver_8}-${formatdate("YYYYMMDD", timestamp())}.x86_64.virtualbox.box"
]
only = ["virtualbox-iso.almalinux-8"]
}
post-processor "shell-local" {
inline = [
"tools/raw-to-vagrant-hyperv.sh ${source.name} AlmaLinux-8-Vagrant-${var.os_ver_8}-${formatdate("YYYYMMDD", timestamp())}.x86_64.hyperv"
]
only = ["qemu.almalinux-8-hyperv-x86_64"]
}
post-processor "artifice" {
files = [
"AlmaLinux-8-Vagrant-${var.os_ver_8}-${formatdate("YYYYMMDD", timestamp())}.x86_64.hyperv.box",
"AlmaLinux-8-Vagrant-${var.os_ver_8}-${formatdate("YYYYMMDD", timestamp())}.x86_64.hyperv.raw",
]
only = ["qemu.almalinux-8-hyperv-x86_64"]
}
}
}