====== Terraform libvirt - Multiplas VMs ====== $ mkdir -p ~/terraform/proviers/libvirt/vms $ cd ~/terraform/proviers/libvirt/vms $ sudo mkdir /var/lib/libvirt/templates $ sudo virsh pool-define-as --name templates --type dir --target /var/lib/libvirt/templates $ sudo virsh pool-autostart templates $ sudo virsh pool-start templates $ sudo virsh pool-list $ wget https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img -P /var/lib/libvirt/templates/ $ wget https://cdimage.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2 -P /var/lib/libvirt/templates/ $ wget https://yum.oracle.com/templates/OracleLinux/OL9/u3/x86_64/OL9U3_x86_64-kvm-b220.qcow2 -P /var/lib/libvirt/templates/ $ ssh-keygen -t ed25519 -f vms -C "g3anmart1ns@gmail.com" $ cat vms.pub ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIU6UhQ8OZfNCL1tYtu3z/u63uQkbjgrRhl3IUKcelb7 g3anmart1ns@gmail.com $ terraform apply [...] │ Error: error creating libvirt domain: internal error: qemu unexpectedly closed the monitor: 2024-04-16T20:05:08.995427Z qemu-system-x86_64: -blockdev {"driver":"file","filename":"/var/lib/libvirt/images/debian","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}: Could not open '/var/lib/libvirt/images/debian': Permission denied │ │ with libvirt_domain.vms[1], │ on main.tf line 62, in resource "libvirt_domain" "vms": │ 62: resource "libvirt_domain" "vms" { │ ╵ ╷ │ Error: error creating libvirt domain: internal error: process exited while connecting to monitor: 2024-04-16T20:05:09.088485Z qemu-system-x86_64: -blockdev {"driver":"file","filename":"/var/lib/libvirt/images/centos","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}: Could not open '/var/lib/libvirt/images/centos': Permission denied │ │ with libvirt_domain.vms[0], │ on main.tf line 62, in resource "libvirt_domain" "vms": │ 62: resource "libvirt_domain" "vms" { │ ╵ ╷ │ Error: error creating libvirt domain: internal error: process exited while connecting to monitor: 2024-04-16T20:05:09.160739Z qemu-system-x86_64: -blockdev {"driver":"file","filename":"/var/lib/libvirt/images/ubuntu","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}: Could not open '/var/lib/libvirt/images/ubuntu': Permission denied │ │ with libvirt_domain.vms[2], │ on main.tf line 62, in resource "libvirt_domain" "vms": │ 62: resource "libvirt_domain" "vms" { │ ╵