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
|
# 5. Installation et configuration de Tailscale
|
||||||
runcmd:
|
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" ]
|
- [ sh, -c, "curl -fsSL https://tailscale.com/install.sh | sh" ]
|
||||||
- [ tailscale, up, --authkey=${tailscale_auth_key}, --hostname=${vm_name} ]
|
- [ tailscale, up, --authkey=${tailscale_auth_key}, --hostname=${vm_name} ]
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ locals {
|
|||||||
resource "proxmox_virtual_environment_vm" "vms" {
|
resource "proxmox_virtual_environment_vm" "vms" {
|
||||||
for_each = var.virtual_machines
|
for_each = var.virtual_machines
|
||||||
|
|
||||||
name = "${each.key}.${var.domain_suffix}"
|
name = "${each.key}.${var.domain_suffix}"
|
||||||
node_name = var.target_node
|
node_name = var.target_node
|
||||||
tags = concat(["terraform-managed", "vm"], each.value.tags)
|
tags = concat(["terraform-managed", "vm"], each.value.tags)
|
||||||
on_boot = lookup(each.value, "on_boot", true)
|
on_boot = lookup(each.value, "on_boot", true)
|
||||||
|
stop_on_destroy = true
|
||||||
|
|
||||||
# Configuration de l'agent QEMU
|
# Configuration de l'agent QEMU
|
||||||
agent {
|
agent {
|
||||||
|
|||||||
Reference in New Issue
Block a user