ansible-community / molecule-plugins

Collection on molecule plugins
MIT License
101 stars 67 forks source link

Driver vagrant does not provide a schema #175

Closed OGrigorios closed 11 months ago

OGrigorios commented 11 months ago

I am currently facing the issue of wanting to run molecule with vagrant+libvirt. I have verified that I can create virtual machines with vagrant+libvirt via vagrant-cli. This perhaps leads to the error of:

TASK [Gather system info] ******************************************************
fatal: [test-wg-debianbull]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname test-wg-debianbull: Name or service not known", "
unreachable": true}

My molecule.yml:

---
dependency:
  name: galaxy
driver:
  name: vagrant
  provider:
    name: libvirt
    type: libvirt
    options:
      memory: 192
      cpus: 2
platforms:
  - name: test-debianbull
    box: debian/bullseye64
    interfaces:
      - auto_config: true
        network_name: private_network
        type: static
        ip: 192.168.10.10
provisioner:
  name: ansible
verifier:
  name: ansible

And my converge.yml

---
- name: Converge
  hosts: all
  become: true
  remote_user: vagrant
  tasks:
    - name: "Include g7s.unbound"
      ansible.builtin.include_role:
        name: "g7s.unbound"

And the output from molecule --version

❯ molecule --version
molecule 5.1.0 using python 3.11
    ansible:2.15.1
    azure:23.4.1 from molecule_plugins
    containers:23.4.1 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1
    delegated:5.1.0 from molecule
    docker:23.4.1 from molecule_plugins requiring collections: community.docker>=3.0.2 ansible.posix>=1.4.0
    ec2:23.4.1 from molecule_plugins
    gce:23.4.1 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0
    podman:23.4.1 from molecule_plugins requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0
    vagrant:23.4.1 from molecule_plugins

I would appreciate any indicators of what might be wrong here. There was a similar issue in 2017, but that did not help me.

konstruktoid commented 11 months ago

I don't see libvirt among the Molecule modules, and it seems molecule-libvirt has been archived.

Can you run a verbose molecule test?

OGrigorios commented 11 months ago

Hm, that is true. But I am using libvirt through Vagrant, so I thought vagrant handles libvirt and molecule handels Vagrant. Maybe I am wrong in this assumption. The moleucle test:

❯ molecule test
WARNING  Driver vagrant does not provide a schema.
INFO     default scenario test matrix: dependency, cleanup, destroy, syntax, create, prepare, converge, idempotence, side_effect, verify, cleanup, destroy
INFO     Performing prerun with role_name_check=0...
INFO     Set ANSIBLE_LIBRARY=/home/g7s/.cache/ansible-compat/0e2a58/modules:/home/g7s/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/home/g7s/.cache/ansible-compat/0e2a58/collections:/home/g7s/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/home/g7s/.cache/ansible-compat/0e2a58/roles:/home/g7s/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Using /home/g7s/.cache/ansible-compat/0e2a58/roles/g7s.unbound symlink to current repository in order to enable Ansible to find the role using its expected full name.
INFO     Running default > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default > destroy

PLAY [Destroy] *****************************************************************

TASK [Destroy molecule instance(s)] ********************************************
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "ERROR: Driver missing, install python-vagrant.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

CRITICAL Ansible return code was 2, command was: ['ansible-playbook', '--inventory', '/home/g7s/.cache/molecule/unbound/default/inventory', '--skip-tags', 'molecule-notest,notest', '/usr/lib/python3.11/site-packages/molecule_plugins/vagrant/playbooks/destroy.yml']
WARNING  An error occurred during the test sequence action: 'destroy'. Cleaning up.
INFO     Running default > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default > destroy

PLAY [Destroy] *****************************************************************

TASK [Destroy molecule instance(s)] ********************************************
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "ERROR: Driver missing, install python-vagrant.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

CRITICAL Ansible return code was 2, command was: ['ansible-playbook', '--inventory', '/home/g7s/.cache/molecule/unbound/default/inventory', '--skip-tags', 'molecule-notest,notest', '/usr/lib/python3.11/site-packages/molecule_plugins/vagrant/playbooks/destroy.yml']
apatard commented 11 months ago

The schema warning is just a warning. It could have been written at "info" severity level but it's better to have it as warning so that we don't forget to provide driver specific schema.

TASK [Destroy molecule instance(s)] ********************************************
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "ERROR: Driver missing, install python-vagrant.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

Looks like you're missing python-vagrant. Did you install it ?

OGrigorios commented 11 months ago

It wasn't installed... Ouch. It is running now. Thank you for your quick help, guys!