Attempt to properly match build w/ source #2
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2023-01-25 14:35:54 +01:00
parent 8a753daed7
commit 3f2f19b36a
2 changed files with 13 additions and 39 deletions

View File

@ -6,45 +6,20 @@ packer {
build {
source "vsphere-iso.ubuntu" {
name = "bootstrap"
vm_name = "${var.vm_name}-{{ build `PackerRunUUID` }}"
}
vm_name = "${var.vm_name}-bootstrap"
provisioner "ansible" {
pause_before = "2m30s"
playbook_file = "ansible/playbook.yml"
user = "ubuntu"
ansible_env_vars = [
"ANSIBLE_CONFIG=ansible/ansible.cfg",
"PYTHONUNBUFFERED=1"
]
use_proxy = "false"
extra_arguments = [
"--extra-vars", "appliancetype=${source.name}",
"--extra-vars", "ansible_ssh_pass=${var.ssh_password}"//,
// "--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 \\",
" -ApplianceType '${source.name}' \\",
" -OVFFile '/scratch/airgapped-k8s/${var.vm_name}-{{ build `PackerRunUUID` }}.ovf' \"",
"pwsh -file scripts/Update-Manifest.ps1 \\",
" -ManifestFileName '/scratch/airgapped-k8s/${var.vm_name}-{{ build `PackerRunUUID` }}.mf'",
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
" '/scratch/airgapped-k8s/${var.vm_name}-{{ build `PackerRunUUID` }}.ovf' \\",
" /output/airgapped-k8s.${source.name}.ova"
]
export {
output_directory = "/scratch/airgapped-k8s/bootstrap"
}
}
build {
source "vsphere-iso.ubuntu" {
name = "upgrade"
vm_name = "${var.vm_name}-{{ build `PackerRunUUID` }}"
vm_name = "${var.vm_name}-upgrade"
export {
output_directory = "/scratch/airgapped-k8s/upgrade"
}
}
provisioner "ansible" {
@ -69,11 +44,11 @@ build {
inline = [
"pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\",
" -ApplianceType '${source.name}' \\",
" -OVFFile '/scratch/airgapped-k8s/${var.vm_name}-{{ build `PackerRunUUID` }}.ovf' \"",
" -OVFFile '/scratch/airgapped-k8s/${source.name}/${var.vm_name}-${source.name}.ovf' \"",
"pwsh -file scripts/Update-Manifest.ps1 \\",
" -ManifestFileName '/scratch/airgapped-k8s/${var.vm_name}-{{ build `PackerRunUUID` }}.mf'",
" -ManifestFileName '/scratch/airgapped-k8s/${source.name}/${var.vm_name}-${source.name}.mf'",
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
" '/scratch/airgapped-k8s/${var.vm_name}-{{ build `PackerRunUUID` }}.ovf' \\",
" '/scratch/airgapped-k8s/${source.name}/${var.vm_name}-${source.name}.ovf' \\",
" /output/airgapped-k8s.${source.name}.ova"
]
}

View File

@ -56,6 +56,5 @@ source "vsphere-iso" "ubuntu" {
export {
images = false
output_directory = "/scratch/airgapped-k8s"
}
}