Parallel build of bootstrap/upgrade ova;Split ansible tasks respectively
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
46
packer/build.pkr.hcl
Normal file
46
packer/build.pkr.hcl
Normal file
@ -0,0 +1,46 @@
|
||||
packer {
|
||||
required_plugins {
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
source "vsphere-iso.ubuntu" {
|
||||
name = "bootstrap"
|
||||
vm_name = "${var.vm_name}-bootstrap"
|
||||
}
|
||||
|
||||
source "vsphere-iso.ubuntu" {
|
||||
name = "upgrade"
|
||||
vm_name = "${var.vm_name}-upgrade"
|
||||
}
|
||||
|
||||
provisioner "ansible" {
|
||||
pause_before = "2m30s"
|
||||
|
||||
playbook_file = "ansible/playbook.yml"
|
||||
user = "ubuntu"
|
||||
ansible_env_vars = [
|
||||
"ANSIBLE_CONFIG=ansible/ansible.cfg"
|
||||
]
|
||||
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}.ovf' \"",
|
||||
"pwsh -file scripts/Update-Manifest.ps1 \\",
|
||||
" -ManifestFileName '/scratch/airgapped-k8s/${var.vm_name}.mf'",
|
||||
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
|
||||
" '/scratch/airgapped-k8s/${var.vm_name}.ovf' \\",
|
||||
" /output/airgapped-k8s.${source.name}.ova"
|
||||
]
|
||||
}
|
||||
}
|
@ -1,15 +1,9 @@
|
||||
packer {
|
||||
required_plugins {
|
||||
}
|
||||
}
|
||||
|
||||
source "vsphere-iso" "k8sbootstrap" {
|
||||
source "vsphere-iso" "ubuntu" {
|
||||
vcenter_server = var.vcenter_server
|
||||
username = var.vsphere_username
|
||||
password = var.vsphere_password
|
||||
insecure_connection = "true"
|
||||
|
||||
vm_name = "${var.vm_guestos}-${var.vm_name}"
|
||||
datacenter = var.vsphere_datacenter
|
||||
cluster = var.vsphere_cluster
|
||||
host = var.vsphere_host
|
||||
@ -60,42 +54,7 @@ source "vsphere-iso" "k8sbootstrap" {
|
||||
|
||||
export {
|
||||
images = false
|
||||
output_directory = "/scratch/k8sbootstrap"
|
||||
output_directory = "/scratch/airgapped-k8s"
|
||||
}
|
||||
remove_cdrom = true
|
||||
}
|
||||
|
||||
build {
|
||||
sources = [
|
||||
"source.vsphere-iso.k8sbootstrap"
|
||||
]
|
||||
|
||||
provisioner "ansible" {
|
||||
pause_before = "2m30s"
|
||||
|
||||
playbook_file = "ansible/playbook.yml"
|
||||
user = "ubuntu"
|
||||
ansible_env_vars = [
|
||||
"ANSIBLE_CONFIG=ansible/ansible.cfg"
|
||||
]
|
||||
use_proxy = "false"
|
||||
extra_arguments = [
|
||||
"--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 \\",
|
||||
" -OVFFile '/scratch/k8sbootstrap/${var.vm_guestos}-${var.vm_name}.ovf' \\",
|
||||
" -Parameter @{'appliance.name'='${var.vm_guestos}';'appliance.version'='${var.vm_name}'}\"",
|
||||
"pwsh -file scripts/Update-Manifest.ps1 \\",
|
||||
" -ManifestFileName '/scratch/k8sbootstrap/${var.vm_guestos}-${var.vm_name}.mf'",
|
||||
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
|
||||
" '/scratch/k8sbootstrap/${var.vm_guestos}-${var.vm_name}.ovf' \\",
|
||||
" /output/Kubernetes.Bootstrap.Appliance.ova"
|
||||
]
|
||||
}
|
||||
}
|
@ -14,7 +14,6 @@ variable "vsphere_datastore" {}
|
||||
variable "vsphere_network" {}
|
||||
|
||||
variable "vm_name" {}
|
||||
variable "vm_guestos" {}
|
||||
variable "ssh_password" {
|
||||
sensitive = true
|
||||
}
|
||||
|
Reference in New Issue
Block a user