ansible-koji/opentofu/cs10-repo.tf
Rénich Bon Ćirić c290878c96
feat: deploy Caddy repository server for BaseOS packages
- Provision cs10-repo.mx-os VM with 500 GB system disk using OpenTofu.
- Create and apply Ansible role to install and configure Caddy to serve /srv/repo/.
- Update Koji Hub export script to rsync signed binary RPMs to the repo server and trigger createrepo_c.
- Record ADR-05 detailing this design decision and update package compilation guide.
- Log progress in the project journal.

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

150 lines
2.8 KiB
HCL

resource "libvirt_domain" "cs10-repo" {
name = "cs10-repo.mx-os"
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/cs10-repo.mx-os_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-repo-system.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-repo-cloudinit.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-repo-system" {
name = "cs10-repo.mx-os-system.qcow2"
pool = var.pool_name
capacity = 536870912000 # 500 GiB (500 * 1024 * 1024 * 1024)
target = {
format = {
type = "qcow2"
}
}
create = {
content = {
url = "file://${var.base_image_path}"
}
}
}
resource "libvirt_cloudinit_disk" "cs10-repo-cloudinit" {
name = "cs10-repo.mx-os-cloudinit.iso"
user_data = templatefile("templates/cloudinit.cfg.tftpl", {
root_password = var.root_password
hostname = "cs10-repo.mx-os"
})
meta_data = yamlencode({
instance-id = "cs10-repo.mx-os"
local-hostname = "cs10-repo.mx-os"
})
}
resource "libvirt_volume" "cs10-repo-cloudinit-volume" {
name = "cs10-repo.mx-os-cloudinit.iso"
pool = var.pool_name
target = {
format = {
type = "iso"
}
}
create = {
content = {
url = libvirt_cloudinit_disk.cs10-repo-cloudinit.path
}
}
}