Libvirt OpenTofu provider
dmacvicar/libvirt
OpenTofu setup
Install on laptop (for cloud-init disk):
sudo pacman -S cdrtools
Server setup
- Follow debian wiki:installation
Pool
- Create libvirt directory storage pool
lvcreate -L 60gb -n libvirt-pool ricote-vg
mkfs.ext4 -m 0 -L libvirt-pool /dev/ricote-vg/libvirt-pool
echo 'UUID=a64797fa-7a59-4e1e-93a6-c3920a9ac26b /var/lib/libvirt/images/ ext4 errors=remount-ro 0 1' >> /etc/fstab
systemctl daemon-reload
mount -a
- LVM pool doesn't work:
- lvm usage cases
- Using a
backingStoreas baseimage and creating a bigger root LVM volume doesn't work, therefore sticking with directory storage pools for now. Related issues:
Cloud-init
Issues
- Images are created with root user and I get access denied #978
Solution: Disable apparmor in
/etc/ibvirt/qemu.conf - Domain cannot get installed because of apparmor: See security/apparmor.md
Issues solved with v0.9:
- Beware, this version of the provider breaks compatibility
- LVM support
- can't find storage pool 'default' on remote libvirt host over SSH
- Changing some resources lead to their destruction and recreation
Other OpenTofu providers
- Outdated, but still interesting: camptocamp/terraform-libvirt-k3s Although k3os is dead