-
Notifications
You must be signed in to change notification settings - Fork 5
/
virtualbox.pkr.hcl
107 lines (94 loc) · 2.41 KB
/
virtualbox.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
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 "virtualbox-ovf" "virtualbox" {
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}-virtualbox-factory/ClearLinux-${var.version}.ova"
checksum = "none"
guest_additions_mode = "upload"
vboxmanage = [
[
"modifyvm",
"{{ .Name }}",
"--memory", "2048"
], [
"modifyvm",
"{{ .Name }}",
"--ostype",
"Linux26_64"
], [
"modifyvm",
"{{ .Name }}",
"--cpus", "2"
], [
"modifyvm",
"{{ .Name }}",
"--chipset", "ich9"
], [
"modifyvm",
"{{ .Name }}",
"--firmware", "efi"
], [
"modifyvm",
"{{ .Name }}",
"--paravirtprovider",
"kvm"
], [
"modifyvm",
"{{ .Name }}",
"--rtcuseutc", "on"
], [
"modifyvm",
"{{ .Name }}",
"--boot1", "disk"
]
]
}
build {
sources = ["source.virtualbox-ovf.virtualbox"]
provisioner "shell" {
inline = ["sudo timedatectl set-ntp true"]
}
provisioner "shell" {
execute_command = "sudo bash {{ .Path }}"
script = "vboxguestsetup.sh"
}
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"
}
}