ansible-role-libvirt-host icon indicating copy to clipboard operation
ansible-role-libvirt-host copied to clipboard

Failure creating storage pool on ubuntu 19.10

Open velis74 opened this issue 5 years ago • 4 comments

Trying to get this role working, but got stuck with:

TASK [stackhpc.libvirt-host : Ensure libvirt storage pools are defined] ********************************************************************
failed: [ansible-host] (item={'name': 'default', 'type': 'dir', 'path': '/var/lib/libvirt/images', 'mode': 755, 'owner': 'libvirt-qemu', 'group': 'kvm'}) => {"ansible_loop_var": "item", "changed": false, "item": {"group": "kvm", "mode": 755, "name": "default", "owner": "libvirt-qemu", "path": "/var/lib/libvirt/images", "type": "dir"}, "msg": "The `libvirt` module is not importable. Check the requirements."}

Playbook:

- name: Basic provisioning of VM hosts
  hosts: vm_hosts
  roles:
    - role: stackhpc.libvirt-host
      libvirt_host_pools:
        - name: default
          type: dir
          path: /var/lib/libvirt/images
          mode: 755
          owner: libvirt-qemu
          group: kvm
      libvirt_host_networks:
        - name: default
          mode: nat
          bridge: virbr0
          domain: qemu.local
          ip: 192.168.123.254
          netmask: 255.255.255.0
          dhcp_start: 192.168.123.100
          dhcp_end: 192.168.123.250

A quick internet search shows that mostly this is a result of package dependency misconfiguration in role, but TBH I have no idea how to tackle this.

Will dig some more, but help would also be appreciated.

velis74 avatar Jan 29 '20 05:01 velis74

Eh, stupid me: adding become: yes immediately fixed the issue. I suggest adding it to documentation / example playbook. I'd do a PR, but have no idea why it's not included already?

velis74 avatar Jan 29 '20 05:01 velis74

Hi. Almost all of the tasks have become: true. Which task is missing it?

In your first error, it says The libvirt module is not importable. Check the requirements.

We install either python3-libvirt or python-libvirt, depending on whether libvirt_host_python3 is true. Perhaps it is a py2/3 issue?

markgoddard avatar Jan 29 '20 09:01 markgoddard

We might be able to improve our py2/3 detection. Currently we assume py2 if ansible_python_interpreter is not set. I think that ansible_python is a more reliable source of this information though.

markgoddard avatar Jan 29 '20 09:01 markgoddard

I must admit I don't know about this py2/3 stuff: this was a direct ubuntu 19.10 install from mini.iso (network install) with nothing but sshd selected in tasksel. I always use python3, but I have no idea what ansible does on a host. The machine where I run ansible is also an ubuntu 19.10. It DOES have python2, but ansible is installed in a virtualenv derived from python 3.7.3.

The task that fails should be visible from the error message. It has become: true already.

velis74 avatar Jan 29 '20 13:01 velis74