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"
|
2023-04-03 19:37:09 +00:00
|
|
|
collections_path = "ansible/collections"
|
2023-04-03 14:26:38 +00:00
|
|
|
|
2023-01-18 14:09:32 +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}"
|
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-03-15 09:24:45 +00:00
|
|
|
" /output/airgapped-k8s-${var.k8s_version}.${source.name}.ova"
|
2023-01-18 14:09:32 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|