Files
Bastion-Stid/template/generic.pkr.hcl
Serge NOELandClaude Opus 5.5 1e2bcf21cf Regroupement de la chaîne de tests de charge beWeapon
- template/ : build Packer du template Windows 11 (ex /data/Installer/MyTemplate)
- deploy/   : OpenTofu + playbooks Ansible (ex /data/Tofu)
- bin/Deploy : menu de déploiement (lien depuis /usr/local/bin/Deploy)
- jeton API Proxmox sorti des playbooks vers deploy/proxmox-secret.yml (hors git)
- README.md : documentation de la structure et du mode opératoire
- Ameliorations.md : recommandations pour fiabiliser les mesures
- tests/ (dépôt beWeapon-LT) et archives/ exclus

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:27:51 +01:00

120 lines
3.3 KiB
HCL

locals {
}
source "proxmox-iso" "vm" {
proxmox_url = "https://${var.proxmox_host}/api2/json"
username = var.proxmox_user
password = var.proxmox_password
token = var.proxmox_token
insecure_skip_tls_verify = var.proxmox_insecure_tls
vm_id = var.vmid
vm_name = var.name
# template_name = var.name
# template_description = var.description == "" ? "${var.name}, Generated by packer at ${formatdate("YYYY-MM-DD hh:mm:ss", timestamp())} <br/>**User**: Installer" : var.description
node = var.node
pool = var.pool
cpu_type = var.cpu_type
sockets = var.cpu_sockets
cores = var.cpu_cores
memory = var.memory
http_interface = var.packer_http_interface
http_bind_address = var.packer_http_bind_address
http_port_min = var.packer_http_port == -1 ? 8000 : "${var.packer_http_port}"
http_port_max = var.packer_http_port == -1 ? 9000 : "${var.packer_http_port}"
disks {
storage_pool = var.disk_storage_pool
disk_size = var.disk_size
#format = var.disk_format
type = var.disk_type
cache_mode = var.disk_cache
}
network_adapters {
bridge = var.network_adapter
model = var.network_adapter_model
mac_address = var.network_adapter_mac
vlan_tag = var.network_adapter_vlan == -1 ? "" : "${var.network_adapter_vlan}"
firewall = var.network_adapter_firewall
}
vga {
type = var.vga_type
memory = var.vga_memory
}
os = var.os
scsi_controller = var.scsi_controller
onboot = var.start_at_boot
qemu_agent = var.qemu_agent
bios = var.bios
boot_iso {
iso_file = "${var.iso_storage_pool}:iso/${var.iso_file}"
iso_download_pve = var.iso_download_pve
unmount = var.iso_unmount
}
# Drivers virtio
additional_iso_files {
#index = 2
iso_storage_pool = "local"
iso_file = "local:iso/virtio-win.iso"
unmount = false
}
# --- INJECTION DE L'AUTOUNATTEND VIA ISO ---
additional_iso_files {
# index = 1
iso_storage_pool = "local"
iso_file = "local:iso/unattended-win.iso"
unmount = false
}
cloud_init = var.cloud_init
cloud_init_storage_pool = var.cloud_init_storage_pool
boot = "order=${var.disk_type}0;ide2;net0"
#boot_command = [""]
boot_wait = var.boot_wait
task_timeout = var.task_timeout
http_directory = var.http_directory
communicator = var.communicator
ssh_username = var.ssh_username
ssh_password = var.ssh_password
ssh_timeout = var.ssh_timeout
winrm_username = var.winrm_username
winrm_password = var.winrm_password
winrm_insecure = var.winrm_insecure
winrm_use_ssl = var.winrm_use_ssl
}
build {
name = "build"
sources = ["source.proxmox-iso.vm"]
provisioner "powershell" {
scripts = [
"http/Drivers.ps1",
"http/GuestTools.ps1",
"http/DotNet.ps1",
"http/Windows.ps1",
"http/s0_autologon.ps1",
"http/s1_beweapon.ps1",
"http/s2_appium.ps1",
"http/s3_pysnapcap.ps1",
"http/s4_dotNet.ps1",
"http/s6_tasks.ps1"
]
}
provisioner "windows-restart" {
restart_timeout = "2m"
}
}