Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Driver vagrant does not provide a schema #175

Closed
OGrigorios opened this issue Jul 20, 2023 · 6 comments
Closed

Driver vagrant does not provide a schema #175

OGrigorios opened this issue Jul 20, 2023 · 6 comments

Comments

@OGrigorios
Copy link

OGrigorios commented Jul 20, 2023

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Member

apatard commented Jul 21, 2023

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
Copy link
Author

OGrigorios commented Jul 21, 2023

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

@MaKaNu
Copy link

MaKaNu commented Jul 19, 2024

so that we don't forget to provide driver specific schema.

Where do we set the schema and how?

@apatard
Copy link
Member

apatard commented Jul 22, 2024

so that we don't forget to provide driver specific schema.

Where do we set the schema and how?

Sorry, really busy IRL, so no time to work here :( The schema has to be provided with the plugin. Like this: https://github.com/apatard/molecule-plugins/blob/vagrant-schema/src/molecule_plugins/vagrant/schema/driver.json. Anyway, for next discussions, as this bug is closed, please comment to bug #193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants