52 lines
2.0 KiB
HCL
52 lines
2.0 KiB
HCL
#Flavour base
|
|
build {
|
|
name = "quid"
|
|
description = <<EOF
|
|
This builder builds a QEMU image from a Debian cloud image.
|
|
EOF
|
|
source "vmware-vmx.debian" {
|
|
output_directory = "${var.output_dir}/${var.version}/quid"
|
|
vm_name = "quid-${local.output_name}-${var.version}"
|
|
source_path = "${var.output_dir}/${var.version}/base/${local.output_name}-${var.version}.vmx"
|
|
boot_command = [ "<enter><enter><wait>" ]
|
|
ssh_clear_authorized_keys = true
|
|
disk_additional_size = [ 102400 ]
|
|
}
|
|
|
|
// Store temporarily ansible vault password in local file
|
|
provisioner "shell-local" {
|
|
inline = ["echo '${var.quid_ansible_vault_passphrase}' > '${local.locations.provisionning}/quid/.ansible_vault_passphrase'"]
|
|
}
|
|
|
|
// Clone quid-ansible repository
|
|
provisioner "ansible" {
|
|
playbook_file = "${local.locations.provisionning}/quid/clone-quid-ansible.yml"
|
|
// Manjaro/Arch OpenSSH version compatibility mode
|
|
// See https://github.com/hashicorp/packer/issues/11783
|
|
extra_arguments = [ "--scp-extra-args", "'-O'", "-v" ]
|
|
}
|
|
|
|
// Run quid-ansible playbook from cloned repository
|
|
provisioner "ansible" {
|
|
playbook_file = "${local.locations.provisionning}/quid/run-quid-ansible.yml"
|
|
groups = ["quid_server"]
|
|
// Manjaro/Arch OpenSSH version compatibility mode
|
|
// See https://github.com/hashicorp/packer/issues/11783
|
|
extra_arguments = [ "--scp-extra-args", "'-O'", "-v", "--vault-password-file=${local.locations.provisionning}/quid/.ansible_vault_passphrase", "--extra-vars=@${local.locations.provisionning}/quid/ansible-vars.yml" ]
|
|
}
|
|
|
|
// Remove ansible vault password file
|
|
provisioner "shell-local" {
|
|
inline = ["rm -f '${local.locations.provisionning}/quid/.ansible_vault_passphrase'"]
|
|
}
|
|
|
|
post-processor "shell-local" {
|
|
inline = [
|
|
"/bin/sh ${path.cwd}/post-processors/sparsify.sh ${var.output_dir}/${var.version}/quid ${var.image_version}",
|
|
]
|
|
}
|
|
|
|
post-processor "manifest" {
|
|
keep_input_artifact = true
|
|
}
|
|
} |