-
Notifications
You must be signed in to change notification settings - Fork 5
/
vmware.pkr.hcl
74 lines (62 loc) · 1.85 KB
/
vmware.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
variable "box_tag" {
type = string
default = "${env("REPOSITORY")}"
}
variable "cloud_token" {
type = string
default = "${env("VAGRANT_CLOUD_TOKEN")}"
}
variable "name" {
type = string
default = "${env("BOX_NAME")}"
}
variable "version" {
type = string
default = "${env("VERSION")}"
}
source "vmware-vmx" "vmware" {
boot_wait = "20s"
output_directory = "boxes/tmp"
shutdown_command = "cat /dev/zero > zero.fill; sudo sync; sleep 5; sudo sync; rm -f zero.fill; sudo shutdown -P now"
ssh_password = "V@grant!"
ssh_port = 22
ssh_timeout = "5m"
ssh_username = "clear"
vm_name = "${var.name}"
source_path = "media/clear-${var.version}-vmware-factory/ClearLinux-${var.version}.vmx"
vmx_data = {
"cpuid.coresPerSocket" = "1"
memsize = "2048"
numvcpus = "2"
}
vmx_data_post = {
cleanShutdown = "TRUE"
"ethernet0.startConnected" = "TRUE"
"ethernet0.wakeonpcktrcv" = "false"
softPowerOff = "FALSE"
}
}
build {
sources = ["source.vmware-vmx.vmware"]
provisioner "shell" {
inline = ["sudo timedatectl set-ntp true"]
}
provisioner "shell" {
expect_disconnect = true
inline = ["echo 'rebooting...'", "sudo systemctl reboot"]
}
provisioner "shell" {
start_retry_timeout = "600s"
inline = ["uname -a; swupd info"]
}
post-processor "vagrant" {
compression_level = 9
include = ["info.json"]
output = "boxes/{{ .Provider }}/${var.name}-${var.version}.{{ .Provider }}.box"
vagrantfile_template = "Vagrantfile.template.rb"
}
post-processor "checksum" {
checksum_types = ["sha1", "sha256"]
output = "boxes/{{ .BuildName }}/${var.name}-${var.version}.{{.BuildName}}.box.{{.ChecksumType}}.checksum"
}
}