Closed LavBU closed 1 year ago
Issue is fixed:
When host is oracle-8, it is working with no issues.
When Host is Centos-7, there is a need to create a dedicated user on that host and add it to libvirt group:
usermod -a -G libvirt
then to add .ssh and authorized_keys file into it (with the right permission. Works like a charm.
System Information
terraform { required_providers { libvirt = { source = "dmacvicar/libvirt" version = "0.7.1" } } }
Linux distribution
CentOS Linux release 7.9.2009 (Core)
Terraform version
Description of Issue/Question
Provisioning a libvirt VM is working fine when running "terraform apply" on the local host. But when trying to do the same from another server to remote host (same host that is working locally), I'm getting the following errors: Using: uri = "qemu+ssh://root@/system"
getting:
Error: failed to dial libvirt: could not configure SSH authentication methods
Using:
uri = "qemu+ssh://root@/system?keyfile=/root/.ssh/id_ed25519"
getting:
Error: failed to dial libvirt: failed to connect to libvirt on the remote host: ssh: rejected: administratively prohibited (open failed)
(Same with rsa key).
On the target host in /var/log/secure, I can see this error: "refused streamlocal port forward: originator port 0, target /var/run/libvirt/libvirt-sock"
Setup
Relevant main.tf section:
provider "libvirt" { uri = "qemu+ssh://root@/system?keyfile=/root/.ssh/id_ed25519"
}
Thanks, Lavi