build: Refactor/Update packer configuration

This commit is contained in:
Danny Bessems 2024-06-05 10:57:05 +10:00
parent a785e57126
commit 092ce5eabc
4 changed files with 43 additions and 43 deletions

View File

@ -70,21 +70,21 @@ jobs:
- name: Run `packer init` - name: Run `packer init`
id: init id: init
run: packer init -upgrade ./packer run: packer init -upgrade ./packer
# - name: Run `packer validate` - name: Run `packer validate`
# id: validate id: validate
# run: | run: |
# packer validate \ packer validate \
# -only=vsphere-iso.bootstrap \ -only=vsphere-iso.bootstrap \
# -var vm_name=${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:10}-$(openssl rand -hex 3) \ -var vm_name=${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:10}-$(openssl rand -hex 3) \
# -var docker_username=$${DOCKER_USERNAME} \ -var docker_username=${{ secrets.DOCKER_USERNAME }} \
# -var docker_password=$${DOCKER_PASSWORD} \ -var docker_password=${{ secrets.DOCKER_PASSWORD }} \
# -var repo_username=$${REPO_USERNAME} \ -var repo_username=${{ secrets.REPO_USERNAME }} \
# -var repo_password=$${REPO_PASSWORD} \ -var repo_password=${{ secrets.REPO_PASSWORD }} \
# -var ssh_password=$${SSH_PASSWORD} \ -var ssh_password=${{ secrets.SSH_PASSWORD }} \
# -var vsphere_password=$${VSPHERE_PASSWORD} \ -var hv_password=${{ secrets.HV_PASSWORD }} \
# -var k8s_version=$K8S_VERSION \ -var k8s_version=$K8S_VERSION \
# -var appliance_version=$APPLIANCE_VERSION \ -var appliance_version=$APPLIANCE_VERSION \
# ./packer ./packer
# - name: Build Artifact # - name: Build Artifact
# run: packer build -color=false -on-error=abort ./image.pkr.hcl # run: packer build -color=false -on-error=abort ./image.pkr.hcl

View File

@ -1,14 +1,14 @@
source "vsphere-iso" "ubuntu" { source "vsphere-iso" "ubuntu" {
vcenter_server = var.vcenter_server vcenter_server = var.hv_fqdn
username = var.vsphere_username username = var.hv_username
password = var.vsphere_password password = var.hv_password
insecure_connection = "true" insecure_connection = "true"
datacenter = var.vsphere_datacenter datacenter = var.hv_datacenter
cluster = var.vsphere_cluster cluster = var.hv_cluster
host = var.vsphere_host host = var.hv_host
folder = var.vsphere_folder folder = var.hv_folder
datastore = var.vsphere_datastore datastore = var.hv_datastore
guest_os_type = "ubuntu64Guest" guest_os_type = "ubuntu64Guest"
@ -31,7 +31,7 @@ source "vsphere-iso" "ubuntu" {
RAM = 8192 RAM = 8192
network_adapters { network_adapters {
network = var.vsphere_network network = var.hv_network
network_card = "vmxnet3" network_card = "vmxnet3"
} }
storage { storage {

View File

@ -1,17 +1,17 @@
variable "vcenter_server" {} variable "hv_fqdn" {}
variable "vsphere_username" {} variable "hv_username" {}
variable "vsphere_password" { variable "hv_password" {
sensitive = true sensitive = true
} }
variable "vsphere_host" {} variable "hv_host" {}
variable "vsphere_datacenter" {} variable "hv_datacenter" {}
variable "vsphere_cluster" {} variable "hv_cluster" {}
variable "vsphere_templatefolder" {} variable "hv_templatefolder" {}
variable "vsphere_folder" {} variable "hv_folder" {}
variable "vsphere_datastore" {} variable "hv_datastore" {}
variable "vsphere_network" {} variable "hv_network" {}
variable "vm_name" {} variable "vm_name" {}
variable "ssh_password" { variable "ssh_password" {

View File

@ -1,9 +1,9 @@
vcenter_server = "bv11-vc.bessems.lan" hv_fqdn = "lab-vc-01.bessems.lan"
vsphere_username = "administrator@vsphere.local" hv_username = "administrator@vsphere.local"
vsphere_datacenter = "DeSchakel" hv_datacenter = "4/55-Clydebank-Rd"
vsphere_cluster = "Cluster.01" hv_cluster = "Cluster.01"
vsphere_host = "bv11-esx02.bessems.lan" hv_host = "lab-esx-02.bessems.lan"
vsphere_datastore = "ESX02.SSD02" hv_datastore = "ESX02.SSD02"
vsphere_folder = "/Packer" hv_folder = "/Packer"
vsphere_templatefolder = "/Templates" hv_templatefolder = "/Templates"
vsphere_network = "LAN" hv_network = "LAN"