Files
iac-homelab/cloud-init/user-data.yml.tftpl
darnodo 6d7a0e64ab
All checks were successful
Terraform Deploy / Validate (push) Successful in 14s
Terraform Deploy / Plan (push) Successful in 5s
Terraform Deploy / Apply (push) Has been skipped
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.
2025-12-11 19:12:31 +01:00

33 lines
794 B
Plaintext

#cloud-config
# 1. Configuration du nom d'hôte de la machine
hostname: ${hostname}
fqdn: ${hostname}
preserve_hostname: false
# 2. Création de l'utilisateur
users:
- name: ${username}
sudo: ALL=(ALL) NOPASSWD:ALL
groups: sudo, admin
shell: /bin/bash
ssh_authorized_keys:
- ${ssh_key}
# 3. Mise à jour du système
package_update: true
package_upgrade: true
# 4. Installation des paquets
packages:
- qemu-guest-agent
- curl
# 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} ]