2023-01-18 14:09:32 +00:00
|
|
|
packer {
|
|
|
|
required_plugins {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
build {
|
|
|
|
source "vsphere-iso.ubuntu" {
|
|
|
|
name = "bootstrap"
|
2023-01-25 13:40:28 +00:00
|
|
|
vm_name = "ova.bootstrap-${var.vm_name}"
|
2023-01-25 13:16:50 +00:00
|
|
|
|
2023-01-25 13:35:54 +00:00
|
|
|
export {
|
2023-01-25 13:40:28 +00:00
|
|
|
images = false
|
2023-01-25 13:35:54 +00:00
|
|
|
output_directory = "/scratch/airgapped-k8s/bootstrap"
|
|
|
|
}
|
2023-01-25 13:16:50 +00:00
|
|
|
}
|
|
|
|
|
2023-01-18 14:09:32 +00:00
|
|
|
source "vsphere-iso.ubuntu" {
|
|
|
|
name = "upgrade"
|
2023-01-25 13:40:28 +00:00
|
|
|
vm_name = "ova.upgrade-${var.vm_name}"
|
2023-01-25 13:35:54 +00:00
|
|
|
|
|
|
|
export {
|
2023-01-25 13:40:28 +00:00
|
|
|
images = false
|
2023-01-25 13:35:54 +00:00
|
|
|
output_directory = "/scratch/airgapped-k8s/upgrade"
|
|
|
|
}
|
2023-01-18 14:09:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
provisioner "ansible" {
|
2023-02-06 09:59:41 +00:00
|
|
|
pause_before = "45s"
|
2023-01-18 14:09:32 +00:00
|
|
|
|
|
|
|
playbook_file = "ansible/playbook.yml"
|
|
|
|
user = "ubuntu"
|
|
|
|
ansible_env_vars = [
|
2023-01-18 17:42:21 +00:00
|
|
|
"ANSIBLE_CONFIG=ansible/ansible.cfg",
|
|
|
|
"PYTHONUNBUFFERED=1"
|
2023-01-18 14:09:32 +00:00
|
|
|
]
|
|
|
|
use_proxy = "false"
|
|
|
|
extra_arguments = [
|
|
|
|
"--extra-vars", "appliancetype=${source.name}",
|
2023-03-02 09:23:38 +00:00
|
|
|
"--extra-vars", "ansible_ssh_pass=${var.ssh_password}",
|
|
|
|
"--extra-vars", "repo_username=${var.repo_username}",
|
|
|
|
"--extra-vars", "repo_password=${var.repo_password}"
|
2023-01-18 14:09:32 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
post-processor "shell-local" {
|
|
|
|
inline = [
|
|
|
|
"pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\",
|
2023-01-19 15:08:20 +00:00
|
|
|
" -ApplianceType '${source.name}' \\",
|
2023-01-25 13:40:28 +00:00
|
|
|
" -OVFFile '/scratch/airgapped-k8s/${source.name}/ova.${source.name}-${var.vm_name}.ovf' \"",
|
2023-01-18 14:09:32 +00:00
|
|
|
"pwsh -file scripts/Update-Manifest.ps1 \\",
|
2023-01-25 13:40:28 +00:00
|
|
|
" -ManifestFileName '/scratch/airgapped-k8s/${source.name}/ova.${source.name}-${var.vm_name}.mf'",
|
2023-01-18 14:09:32 +00:00
|
|
|
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
|
2023-01-25 13:40:28 +00:00
|
|
|
" '/scratch/airgapped-k8s/${source.name}/ova.${source.name}-${var.vm_name}.ovf' \\",
|
2023-01-18 14:09:32 +00:00
|
|
|
" /output/airgapped-k8s.${source.name}.ova"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|