-
Notifications
You must be signed in to change notification settings - Fork 0
/
VirtualBox.pkr.hcl
77 lines (74 loc) · 1.94 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
variable "cpus" {
type = number
default = 1
description = "# of CPUs"
}
variable "memory" {
type = number
default = 1024
description = "Memory in MBs"
}
variable "disk" {
type = number
default = 8192
description = "Disk space in MBs"
validation {
condition = var.disk > 4096
error_message = "Disk size must be higher than 4 GB."
}
}
variable "format" {
type = string
default = "ova"
description = "Output image type - can be ova or ovf"
validation {
condition = var.format == "ova" || var.format == "ovf"
error_message = "Format can be either ova or ovf."
}
}
variable "root_password" {
type = string
default = "secret"
description = "The root password"
}
source "virtualbox-iso" "jeos-vm" {
# The JeOS ISO file should reside in the same folder as the template file
iso_url = "gunet-jeos-debian-11.8.0.iso"
iso_checksum = "none"
# # of CPUs
cpus = var.cpus
# Memory in MBs
memory = var.memory
# Disk size in MBs
# JeOS requires at least 4GB (4096MB) for automatic setup
disk_size = var.disk
# vm_name = "packer-BUILDNAME"
# format can be ova or ovf
# We choose ova to output just one file
format = "ova"
# output_directory = "output-BUILDNAME"
# output_filename = "${vm_name}"
guest_os_type = "Debian11_64"
headless = false
communicator = "ssh"
ssh_username = "root"
ssh_password = var.root_password
ssh_port = 65432
# This should be the private key that corresponds to the
# authorized_keys public keys inserted in the ISO by jeos-builder
ssh_private_key_file = "id_ecdsa.txt"
ssh_timeout = "20m"
shutdown_command = "echo 'packer' | shutdown -P now"
}
build {
name = "packer-virtualbox-vm"
sources = ["sources.virtualbox-iso.jeos-vm"]
}
packer {
required_plugins {
virtualbox = {
version = "~> 1"
source = "github.com/hashicorp/virtualbox"
}
}
}