85 lines
1.7 KiB
HCL
85 lines
1.7 KiB
HCL
resource "libvirt_volume" "cs10-base-system" {
|
|
count = var.guest_count
|
|
name = "${var.guest_base_name}-${format("%02d", count.index)}.${var.domain}-system.qcow2"
|
|
base_volume_id = libvirt_volume.cs10-base.id
|
|
pool = var.pool_name
|
|
size = var.disk_size
|
|
}
|
|
|
|
resource "libvirt_domain" "cs10-base" {
|
|
count = var.guest_count
|
|
name = "${var.guest_base_name}-${format("%02d", count.index)}.${var.domain}"
|
|
memory = var.guest_memory
|
|
vcpu = var.guest_vcpu
|
|
qemu_agent = true
|
|
autostart = true
|
|
firmware = "/usr/share/edk2/ovmf/OVMF_CODE_4M.qcow2"
|
|
|
|
cpu {
|
|
mode = "host-passthrough"
|
|
}
|
|
|
|
cloudinit = libvirt_cloudinit_disk.cs10-cloudinit.id
|
|
|
|
network_interface {
|
|
network_name = "default"
|
|
wait_for_lease = true
|
|
}
|
|
|
|
disk {
|
|
volume_id = libvirt_volume.cs10-base-system[count.index].id
|
|
}
|
|
|
|
console {
|
|
type = "pty"
|
|
target_type = "serial"
|
|
target_port = "0"
|
|
}
|
|
|
|
console {
|
|
type = "pty"
|
|
target_type = "virtio"
|
|
target_port = "1"
|
|
}
|
|
|
|
graphics {
|
|
type = "spice"
|
|
listen_type = "address"
|
|
autoport = true
|
|
}
|
|
|
|
video {
|
|
type = "virtio"
|
|
}
|
|
|
|
provisioner "file" {
|
|
source = "scripts"
|
|
destination = "/tmp"
|
|
|
|
connection {
|
|
type = "ssh"
|
|
host = self.name
|
|
timeout = "1m"
|
|
}
|
|
}
|
|
|
|
provisioner "remote-exec" {
|
|
inline = [
|
|
"bash /tmp/scripts/set-hostname.bash ${self.name}",
|
|
"bash /tmp/scripts/dnf-fastest_mirrors.bash",
|
|
"bash /tmp/scripts/install-tools.bash",
|
|
"bash /tmp/scripts/upgrade.bash"
|
|
]
|
|
|
|
connection {
|
|
type = "ssh"
|
|
user = "root"
|
|
host = self.name
|
|
timeout = "5m"
|
|
}
|
|
}
|
|
|
|
xml {
|
|
xslt = file("xslt/ide-to-sata.xslt")
|
|
}
|
|
}
|