initial commit

This commit is contained in:
2026-06-30 13:51:06 -04:00
commit d529284141
10 changed files with 439 additions and 0 deletions

70
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,70 @@
pipeline {
agent any
parameters {
string(
name: 'LIMIT',
defaultValue: '',
description: 'Target host(s)/group(s), e.g. "vms", "lxcs", "docker_hosts", "kubernetes", "update_targets", or a hostname (no .lan required). Leave blank to run against all machines.'
)
booleanParam(
name: 'DRY_RUN',
defaultValue: false,
description: 'Run in check mode (no changes made)'
)
}
environment {
PROXMOX_URL = 'https://192.168.0.166:8006'
PROXMOX_USER = 'dynamic-inventory@pve'
PROXMOX_TOKEN_ID = 'dynamic-inventory'
PROXMOX_TOKEN_SECRET = credentials('PROXMOX_TOKEN_SECRET')
ANSIBLE_HOST_KEY_CHECKING = 'False'
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Verify Inventory') {
steps {
sh '''
echo "Testing dynamic inventory connection..."
ansible-inventory -i inventories/inventory.proxmox.yml --list | head -10
'''
}
}
stage('Run Playbook') {
steps {
script {
def limitFlag = params.LIMIT ? "--limit '${params.LIMIT}'" : ''
def checkFlag = params.DRY_RUN ? '--check --diff' : ''
echo "Limit: '${params.LIMIT ?: 'all'}'"
echo "Dry run: ${params.DRY_RUN}"
sh """
ansible-playbook \
-i inventories/inventory.proxmox.yml \
site.yml \
${limitFlag} \
${checkFlag}
"""
}
}
}
}
post {
success {
echo "site.yml completed successfully (limit: ${params.LIMIT ?: 'all'})"
}
failure {
echo "site.yml failed (limit: ${params.LIMIT ?: 'all'})"
}
}
}