63 lines
2.0 KiB
HCL
63 lines
2.0 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}.img"
|
||
|
disk_size = 10240
|
||
|
iso_url = "${local.source_iso}"
|
||
|
iso_checksum = "${var.iso_cd_checksum}"
|
||
|
http_content = {
|
||
|
"/ssh-packer-pub.key" = data.sshkey.install.public_key
|
||
|
"/install.conf" = templatefile("${local.locations.templates}/conf/install/awnsers.pktpl.hcl", local.installOptsVMWare)
|
||
|
}
|
||
|
boot_command = var.boot_command
|
||
|
cd_label = "cidata"
|
||
|
}
|
||
|
|
||
|
source "qemu.debian" {
|
||
|
output_directory = "${var.output_dir}/${var.version}/base"
|
||
|
vm_name = "${local.output_name}-${var.version}.img"
|
||
|
iso_url = "${local.source_iso}"
|
||
|
iso_checksum = "${var.iso_cd_checksum}"
|
||
|
disk_image = true
|
||
|
disk_size = 10240
|
||
|
cd_content = {
|
||
|
"meta-data" = jsonencode(local.instance_data)
|
||
|
"user-data" = templatefile("${path.cwd}/recipes/debian/templates/conf/cloud-init/user-data",
|
||
|
{ user = local.ssh_user,
|
||
|
password = local.ssh_password,
|
||
|
runcmd = var.cloud_init_runcmd })
|
||
|
}
|
||
|
#http_content = {
|
||
|
# "/ssh-packer-pub.key" = data.sshkey.install.public_key
|
||
|
# "/install.conf" = templatefile("${local.locations.templates}/conf/install/awnsers.pktpl.hcl", local.installOpts)
|
||
|
#}
|
||
|
cd_label = "cidata"
|
||
|
boot_command = var.boot_command
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
}
|