Changed to finding template by id instead of name

This commit is contained in:
2026-02-02 13:58:18 -05:00
parent c12bfa6bad
commit 6074f5e41e
4 changed files with 16 additions and 9 deletions

6
Jenkinsfile vendored
View File

@@ -42,6 +42,8 @@ pipeline {
environment { environment {
ANSIBLE_HOST_KEY_CHECKING = 'False' ANSIBLE_HOST_KEY_CHECKING = 'False'
ANSIBLE_FORCE_COLOR = 'true' ANSIBLE_FORCE_COLOR = 'true'
VM_TEMPLATE_ID = '133'
LXC_TEMPLATE_ID = '109'
} }
stages { stages {
@@ -87,7 +89,9 @@ pipeline {
-e "target_node=${params.TARGET_NODE}" \ -e "target_node=${params.TARGET_NODE}" \
-e "vm_hostname=${params.HOSTNAME}" \ -e "vm_hostname=${params.HOSTNAME}" \
-e "cpu_cores=${params.CPU_CORES}" \ -e "cpu_cores=${params.CPU_CORES}" \
-e "ram_gb=${params.RAM_GB}" -e "ram_gb=${params.RAM_GB}" \
-e "vm_template_id=${VM_TEMPLATE_ID}" \
-e "lxc_template_id=${LXC_TEMPLATE_ID}"
""" """
} }
} }

View File

@@ -37,9 +37,9 @@ proxmox-template-clone/
- **Proxmox cluster** with token-based API authentication - **Proxmox cluster** with token-based API authentication
- **Jenkins server** with Ansible installed - **Jenkins server** with Ansible installed
- **Pre-built templates:** - **Pre-built templates** (referenced by VMID):
- `ubuntu24vm` - Ubuntu 24 VM template - VM template (VMID: 133)
- `ubuntu24lxc` - Ubuntu 24 LXC template - LXC template (VMID: 109)
- **Storage:** `local-lvm` backend for VM/LXC disks - **Storage:** `local-lvm` backend for VM/LXC disks
### Jenkins Configuration ### Jenkins Configuration
@@ -123,9 +123,11 @@ Modify available nodes in the `Jenkinsfile` parameters section.
### Templates ### Templates
Update template names in the respective role task files: Template VMIDs are configured in the Jenkinsfile environment section:
- [roles/proxmox_vm/tasks/main.yml](roles/proxmox_vm/tasks/main.yml) - `VM_TEMPLATE_ID` - VMID of the VM template (currently: 133)
- [roles/proxmox_lxc/tasks/main.yml](roles/proxmox_lxc/tasks/main.yml) - `LXC_TEMPLATE_ID` - VMID of the LXC template (currently: 109)
Update the values in the `environment` block of the Jenkinsfile to use different templates.
## License ## License

View File

@@ -19,7 +19,7 @@
api_token_id: "{{ proxmox_api_token_id }}" api_token_id: "{{ proxmox_api_token_id }}"
api_token_secret: "{{ proxmox_api_token_secret }}" api_token_secret: "{{ proxmox_api_token_secret }}"
node: "{{ target_node }}" node: "{{ target_node }}"
clone: "ubuntu24lxc" clone: "{{ lxc_template_id }}"
hostname: "{{ vm_hostname }}" hostname: "{{ vm_hostname }}"
vmid: "{{ next_vmid }}" vmid: "{{ next_vmid }}"
full: true full: true

View File

@@ -19,7 +19,8 @@
api_token_id: "{{ proxmox_api_token_id }}" api_token_id: "{{ proxmox_api_token_id }}"
api_token_secret: "{{ proxmox_api_token_secret }}" api_token_secret: "{{ proxmox_api_token_secret }}"
node: "{{ target_node }}" node: "{{ target_node }}"
clone: "ubuntu24vm" vmid: "{{ vm_template_id }}"
clone: "template"
name: "{{ vm_hostname }}" name: "{{ vm_hostname }}"
newid: "{{ next_vmid }}" newid: "{{ next_vmid }}"
full: true full: true