This commit is contained in:
Hrankin, Aleksandr (contracted)
2026-02-19 11:34:13 +00:00
commit f243f440c3
191 changed files with 6183 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
# 1) Для каждой VM создаём snippet user-data (cloud-init)
resource "proxmox_virtual_environment_file" "user_data" {
for_each = local.vms
content_type = "snippets"
datastore_id = var.snippets_storage
node_name = var.target_node
source_raw {
data = templatefile("${path.module}/cloud-init/user-data.yaml.tpl", {
hostname = each.value.name
})
file_name = "user-data-${each.value.name}.yaml"
}
}
# 2) Создаём VM-ки и подцепляем user-data файл
module "vm" {
source = "../../../modules/proxmox/vm"
for_each = local.vms
name = each.value.name
target_node = var.target_node
template_id = var.template_id
cpu = each.value.cpu
cpu_type = try(each.value.cpu_type, "qemu64")
memory = each.value.memory
disk_size = each.value.disk_size
storage = var.storage
bridge = var.bridge
osd_storage = try(each.value.osd_storage, null)
osd_disks = try(each.value.osd_disks, [])
user_data_file_id = proxmox_virtual_environment_file.user_data[each.key].id
mac_address = each.value.mac
}