hardcoded template names in script blocks

This commit is contained in:
2026-02-02 16:45:09 -05:00
parent 5426456a4d
commit 84e83c944d

8
Jenkinsfile vendored
View File

@@ -42,8 +42,6 @@ pipeline {
environment { environment {
ANSIBLE_HOST_KEY_CHECKING = 'False' ANSIBLE_HOST_KEY_CHECKING = 'False'
ANSIBLE_FORCE_COLOR = 'true' ANSIBLE_FORCE_COLOR = 'true'
VM_TEMPLATE_HOSTNAME = 'ubuntu24vm'
LXC_TEMPLATE_HOSTNAME = 'ubuntu24lxc'
} }
stages { stages {
@@ -100,7 +98,7 @@ pipeline {
steps { steps {
script { script {
// Use template hostname for ping since the cloned machine still has the template's hostname // Use template hostname for ping since the cloned machine still has the template's hostname
def templateHost = params.PROVISION_TYPE == 'VM' ? env.VM_TEMPLATE_HOSTNAME : env.LXC_TEMPLATE_HOSTNAME def templateHost = params.PROVISION_TYPE == 'VM' ? 'ubuntu24vm' : 'ubuntu24lxc'
def targetHost = "${templateHost}.lan" def targetHost = "${templateHost}.lan"
echo "Waiting for ${targetHost} (template hostname) to become available..." echo "Waiting for ${targetHost} (template hostname) to become available..."
@@ -124,7 +122,7 @@ pipeline {
stage('Copy Jenkins SSH Key') { stage('Copy Jenkins SSH Key') {
steps { steps {
script { script {
def templateHost = params.PROVISION_TYPE == 'VM' ? env.VM_TEMPLATE_HOSTNAME : env.LXC_TEMPLATE_HOSTNAME def templateHost = params.PROVISION_TYPE == 'VM' ? 'ubuntu24vm' : 'ubuntu24lxc'
def targetHost = "${templateHost}.lan" def targetHost = "${templateHost}.lan"
// Use sshpass or expect to handle the initial connection // Use sshpass or expect to handle the initial connection
@@ -139,7 +137,7 @@ pipeline {
stage('Set Hostname') { stage('Set Hostname') {
steps { steps {
script { script {
def templateHost = params.PROVISION_TYPE == 'VM' ? env.VM_TEMPLATE_HOSTNAME : env.LXC_TEMPLATE_HOSTNAME def templateHost = params.PROVISION_TYPE == 'VM' ? 'ubuntu24vm' : 'ubuntu24lxc'
def currentHost = "${templateHost}.lan" def currentHost = "${templateHost}.lan"
def newHostname = params.HOSTNAME def newHostname = params.HOSTNAME