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

View File

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

View File

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

View File

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