ansible-koji/opentofu/cs10-base.tf
Rénich Bon Ćirić 89d6f66be8
feat: Integración de Siguldry PKCS#11 y spooler de firmas
* Implementación del rol de Ansible 'siguldry' para CentOS Stream 10
* Migración del plugin de firmas de Koji Hub a un spooler asíncrono
* Modificación de roles para utilizar empaquetamiento RPM nativo de siguldry-pkcs11
* Documentación de decisiones (ADRs) y roadmap en docs/technical/
* Limpieza de binarios locales pesados de PKCS#11 en Ansible

Co-developed-by: Gemini AI <renich+gemini@woralelandia.com>
Signed-off-by: Rénich Bon Ćirić <renich@woralelandia.com>
2026-06-16 10:06:44 -06:00

156 lines
3.3 KiB
HCL

resource "libvirt_domain" "cs10-base" {
count = var.guest_count
name = "${var.guest_base_name}-${format("%02d", count.index)}.${var.domain}"
memory = var.guest_memory
memory_unit = "MiB"
vcpu = var.guest_vcpu
running = true
autostart = true
type = "kvm"
os = {
type = "hvm"
arch = "x86_64"
machine = "q35"
firmware = "efi"
loader_path = "/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2"
loader_readonly = true
loader_secure = true
loader_type = "pflash"
nvram = {
path = "/var/lib/libvirt/qemu/nvram/${var.guest_base_name}-${format("%02d", count.index)}.${var.domain}_VARS.qcow2"
template = "/usr/share/edk2/ovmf/OVMF_VARS_4M.secboot.qcow2"
format = "qcow2"
}
}
cpu = {
mode = "host-passthrough"
}
features = {
acpi = true
apic = {}
}
devices = {
disks = [
{
type = "volume"
driver = {
type = "qcow2"
}
source = {
volume = {
pool = var.pool_name
volume = libvirt_volume.cs10-base[count.index].name
}
}
target = {
dev = "vda"
bus = "virtio"
}
},
{
type = "volume"
device = "cdrom"
readonly = true
driver = {
type = "raw"
}
source = {
volume = {
pool = var.pool_name
volume = libvirt_cloudinit_disk.cs10-cloudinit[count.index].name
}
}
target = {
dev = "sda"
bus = "sata"
}
}
]
interfaces = [
{
type = "network"
model = {
type = "virtio"
}
source = {
network = {
network = "default"
}
}
}
]
consoles = [
{
type = "pty"
target_type = "virtio"
target_port = "1"
}
]
video = {
type = "virtio"
}
}
}
resource "libvirt_volume" "cs10-base" {
count = var.guest_count
name = "${var.guest_base_name}-${format("%02d", count.index)}.${var.domain}-system.qcow2"
pool = var.pool_name
capacity = 32212254720
target = {
format = {
type = "qcow2"
}
}
create = {
content = {
url = "file://${var.base_image_path}"
}
}
}
resource "libvirt_cloudinit_disk" "cs10-cloudinit" {
count = var.guest_count
name = "${var.guest_base_name}-${format("%02d", count.index)}.${var.domain}-cloudinit.iso"
user_data = templatefile("templates/cloudinit.cfg.tftpl", {
root_password = var.root_password
hostname = "${var.guest_base_name}-${format("%02d", count.index)}.${var.domain}"
})
meta_data = yamlencode({
instance-id = "${var.guest_base_name}-${format("%02d", count.index)}.${var.domain}"
local-hostname = "${var.guest_base_name}-${format("%02d", count.index)}.${var.domain}"
})
}
resource "libvirt_volume" "cloudinit" {
count = var.guest_count
name = "${var.guest_base_name}-${format("%02d", count.index)}.${var.domain}-cloudinit.iso"
pool = var.pool_name
target = {
format = {
type = "iso"
}
}
create = {
content = {
url = libvirt_cloudinit_disk.cs10-cloudinit[count.index].path
}
}
}