ansible-community / molecule-libvirt

Molecule LibVirt Provider
https://github.com/ansible-community/molecule-libvirt/issues/13#issuecomment-1372615418
MIT License
35 stars 19 forks source link

The `libvirt` module is not importable. Check the requirements #46

Closed mhagnumdw closed 2 years ago

mhagnumdw commented 2 years ago

I'm getting the error

"The libvirt module is not importable. Check the requirements."

in the TASK [Get list of all instances]. How to solve this?

Molecule conf

collections.yml

collections:
  - name: community.general
    version: ">=2,<3"
  - name: community.libvirt
  - name: community.crypto
  - name: ansible.posix
  - name: ansible.netcommon

molecule.yml

---
dependency:
  name: galaxy
driver:
  name: libvirt
platforms:
  - name: instance
    cpu: 2
    cpu_model: "qemu64"
    image_url: "https://mirror.cedia.org.ec/fedora/linux/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2"
    disk_size: "10G"
    ssh_port: 22
    memory_size: "1" # in GB
provisioner:
  name: ansible
verifier:
  name: ansible

Environment

$ ansible --version
ansible [core 2.13.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/myuser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/myuser/projetos/ansible-setup-workstation/.venv/lib/python3.10/site-packages/ansible
  ansible collection location = /home/myuser/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/myuser/projetos/ansible-setup-workstation/.venv/bin/ansible
  python version = 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)]
  jinja version = 3.1.2
  libyaml = True
$ molecule --version
molecule 3.6.1 using python 3.10 
    ansible:2.13.0
    delegated:3.6.1 from molecule
    docker:1.1.0 from molecule_docker requiring collections: community.docker>=1.9.1
    libvirt:0.0.5 from molecule_libvirt
$ python --version          
Python 3.10.4

OS verion: Fedora Workstation 35

mhagnumdw commented 2 years ago

After installing the packages below, it worked.

sudo dnf install libvirt-devel
pip install libvirt-python