vms/recipes/debian/main.pkr.hcl

44 lines
1.3 KiB
HCL

#Flavour base
build {
name = "base"
description = <<EOF
This builder builds a QEMU image from a Debian cloud image.
EOF
source "vmware-iso.debian" {
output_directory = "${var.output_dir}/${var.version}/base"
vm_name = "${local.output_name}-${var.version}"
disk_size = 10240
iso_url = "${local.source_iso}"
iso_checksum = "${var.iso_cd_checksum}"
guest_os_type = "ubuntu-64"
http_content = {
"/ssh-packer-pub.key" = data.sshkey.install.public_key
"/preseed.cfg" = templatefile("${local.locations.provisionning}/${var.name}/http/preseed.cfg.pkrtpl.hcl", { data: data, var: var, local: local })
}
boot_command = [
"<esc><wait>",
"auto url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<enter><wait10s>",
"<enter>"
]
}
provisioner "shell" {
script = "${local.locations.provisionning}/${var.name}/${var.name}-${var.short_version}-install.sh"
}
provisioner "shell" {
script = "${local.locations.provisionning}/letsencrypt.sh"
}
post-processor "shell-local" {
inline = [
"/bin/sh ${path.cwd}/post-processors/sparsify.sh ${var.output_dir}/${var.version}/base ${var.image_version}",
]
}
post-processor "manifest" {
keep_input_artifact = true
}
}