feat(vm): enable qemu-guest-agent and set stop_on_destroy
- Add `qemu-guest-agent` enable/start command to `user-data.yml.tftpl` to ensure the agent is active immediately after provisioning. - Set `stop_on_destroy = true` in the Proxmox VM resource definition to ensure graceful shutdown during Terraform destroy operations.
This commit is contained in:
@@ -25,5 +25,8 @@ packages:
|
||||
|
||||
# 5. Installation et configuration de Tailscale
|
||||
runcmd:
|
||||
# Enable and start qemu-guest-agent (systemd)
|
||||
- [ systemctl, enable, qemu-guest-agent, --now ]
|
||||
# Install and configure Tailscale
|
||||
- [ sh, -c, "curl -fsSL https://tailscale.com/install.sh | sh" ]
|
||||
- [ tailscale, up, --authkey=${tailscale_auth_key}, --hostname=${vm_name} ]
|
||||
|
||||
@@ -24,10 +24,11 @@ locals {
|
||||
resource "proxmox_virtual_environment_vm" "vms" {
|
||||
for_each = var.virtual_machines
|
||||
|
||||
name = "${each.key}.${var.domain_suffix}"
|
||||
node_name = var.target_node
|
||||
tags = concat(["terraform-managed", "vm"], each.value.tags)
|
||||
on_boot = lookup(each.value, "on_boot", true)
|
||||
name = "${each.key}.${var.domain_suffix}"
|
||||
node_name = var.target_node
|
||||
tags = concat(["terraform-managed", "vm"], each.value.tags)
|
||||
on_boot = lookup(each.value, "on_boot", true)
|
||||
stop_on_destroy = true
|
||||
|
||||
# Configuration de l'agent QEMU
|
||||
agent {
|
||||
|
||||
Reference in New Issue
Block a user