Packer.Images/packer/build.pkr.hcl

52 lines
1.5 KiB
HCL
Raw Normal View History

packer {
required_plugins {
}
}
build {
source "vsphere-iso.ubuntu" {
name = "bootstrap"
vm_name = "bld_${var.vm_name}_bootstrap"
}
source "vsphere-iso.ubuntu" {
name = "upgrade"
vm_name = "bld_${var.vm_name}_upgrade"
}
provisioner "ansible" {
pause_before = "45s"
playbook_file = "ansible/playbook.yml"
user = "ubuntu"
ansible_env_vars = [
"ANSIBLE_CONFIG=ansible/ansible.cfg",
"PYTHONUNBUFFERED=1"
]
use_proxy = "false"
collections_path = "ansible/collections"
2023-04-03 14:26:38 +00:00
extra_arguments = [
"--extra-vars", "appliancetype=${source.name}",
2023-03-02 09:23:38 +00:00
"--extra-vars", "ansible_ssh_pass=${var.ssh_password}",
2023-03-09 11:45:51 +00:00
"--extra-vars", "docker_username=${var.docker_username}",
2023-03-09 11:47:28 +00:00
"--extra-vars", "docker_password=${var.docker_password}",
2023-03-02 09:23:38 +00:00
"--extra-vars", "repo_username=${var.repo_username}",
"--extra-vars", "repo_password=${var.repo_password}"
]
}
post-processor "shell-local" {
inline = [
"pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\",
2023-01-19 15:08:20 +00:00
" -ApplianceType '${source.name}' \\",
2023-04-05 15:30:24 +00:00
" -OVFFile '/scratch/bld_${var.vm_name}_${source.name}.ovf' \"",
"pwsh -file scripts/Update-Manifest.ps1 \\",
2023-04-05 15:30:24 +00:00
" -ManifestFileName '/scratch/bld_${var.vm_name}_${source.name}.mf'",
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
2023-04-05 15:30:24 +00:00
" '/scratch/bld_${var.vm_name}_${source.name}.ovf' \\",
" /output/airgapped-k8s-${var.k8s_version}.${source.name}.ova"
]
}
}