Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

BUG: Missing create.yml, destroy.yml, molecule_vagrant.py #8

Closed
westurner opened this issue Feb 5, 2020 · 12 comments
Closed

BUG: Missing create.yml, destroy.yml, molecule_vagrant.py #8

westurner opened this issue Feb 5, 2020 · 12 comments

Comments

@westurner
Copy link

westurner commented Feb 5, 2020

CC'ing from "Removed migration and vagrant driver" ansible/molecule#2414 (comment) ansible/molecule#2315 :

When I just copy create.yml and destroy.yml from the links above into the scenario directory,

cd ./molecule/default
wget 'https://github.com/raw/ansible-community/molecule/0cf231a3623e10456fbc21795ae42286ed88e479/molecule/provisioner/ansible/playbooks/vagrant/destroy.yml' 
wget 'https://github.com/raw/ansible-community/molecule/0cf231a3623e10456fbc21795ae42286ed88e479/molecule/provisioner/ansible/playbooks/vagrant/create.yml' 

I'm now getting:

ERROR! couldn't resolve module/action 'molecule_vagrant'. This often indicates a misspelling, missing collection, or incorrect module path.

presumably because molecule_vagrant.py is not in https://github.com/ansible-community/molecule-vagrant ?
https://github.com/ansible-community/molecule/blob/0cf231a3623e10456fbc21795ae42286ed88e479/molecule/provisioner/ansible/plugins/modules/molecule_vagrant.py

https://github.com/ansible-community/molecule/pull/2414/files#diff-9b0cc6dd3c61a1aca9b9482e06c74b0f

So, to workaround this with master:

mkdir -p ~/.ansible/plugins/modules  # any dir in ANSIBLE_LIBRARY (as seen in --debug)
cd ~/.ansible/plugins/modules;
wget https://github.com/raw/ansible-community/molecule/0cf231a3623e10456fbc21795ae42286ed88e479/molecule/provisioner/ansible/plugins/modules/molecule_vagrant.py

Where should these be added in molecule-vagrant?

@westurner westurner changed the title Missing create.yml, destroy.yml, molecule_vagrant.py BUG: Missing create.yml, destroy.yml, molecule_vagrant.py Feb 5, 2020
@sio
Copy link
Contributor

sio commented Feb 5, 2020

I confirm that the following files are missing after splitting molecule-vagrant into a plugin:

# File names are from molecule 2.22 source tree
molecule/provisioner/ansible/playbooks/vagrant/create.yml
molecule/provisioner/ansible/playbooks/vagrant/destroy.yml
molecule/provisioner/ansible/plugins/libraries/molecule_vagrant.py

I'm not sure where to add them though.

I think it'd be useful to add a high-level overview of how plugins/drivers work into documentation. I'm new to molecule and it's difficult to get a clear picture of how it works under the hood. Looks like driver uses the cookiecutter template to create Ansible playbooks that are used for provisioning test infrastructure. Then Ansible runs those playbooks and returns the control back to Molecule. Some info on what goes where in $MOLECULE_EPHEMERAL_DIRECTORY would be nice.

@hswong3i
Copy link
Collaborator

hswong3i commented Feb 13, 2020

# File names are from molecule 2.22 source tree
molecule/provisioner/ansible/playbooks/vagrant/create.yml
molecule/provisioner/ansible/playbooks/vagrant/destroy.yml
molecule/provisioner/ansible/plugins/libraries/molecule_vagrant.py

These 3 files should able to place under your molecule scenario folder as a dirty workaround, e.g.

molecule/default/create.yml
molecule/default/destroy.yml
molecule/default/libraries/molecule_vagrant.py

@ssbarnea As a long run could we create another PR for this?

@ssbarnea
Copy link
Member

I will be back at this as soon I sort molecule v3, probably during next weekend.

@hswong3i
Copy link
Collaborator

@ssbarnea anyway, any hints where the libraries/molecule_vagrant.py should locate in this repo?

I could expect create.yml and destroy.yml copy from v2.20 into:

But I have no idea where libraries/molecule_vagrant.py should goes...

@hswong3i
Copy link
Collaborator

In case of Travis CI + Molecule + Vagrant + Libvirt + KVM + CentOS/openSUSE/Ubuntu setup, you may reference my initial changes for upgrade from 2.22.0 to 3.0.1:

@sio
Copy link
Contributor

sio commented Feb 21, 2020

@hswong3i, cool! I didn't know Travis supported nested virtualization

@geerlingguy
Copy link

@hswong3i you're able to run VirtualBox inside Travis CI??? I tried many times throughout the years and never could get it working.

@sio
Copy link
Contributor

sio commented Feb 21, 2020

@geerlingguy, I believe he is running kvm (via vagrant-libvirt) to test the role that installs Virtualbox, not the Virtualbox itself.

@hswong3i
Copy link
Collaborator

hswong3i commented Feb 22, 2020

@geerlingguy @sio

Since @ssbarnea mention that we may try for libvirt, I give a try and so SUDDENLY found that Travis CI now coming with vmx from /prof/cpuinfo therefore both libvirt + KVM or VirtualBox now works (but I like libvirt more when compare the works for adding additional disk for Ceph test)

Moreover I found that other else github project report that since 2019-08 vmx is UNOFFICIALLY added into GCE instance, that’s also why when I tested with molecule + VirtualBox on early 2019 but still failed :-)

Now all my roles migrated from LXD to Vagrant + libvirt + KVM, no more hacky Docker-systemd is required; IMHO, now this molecule-vagrant become much more useful and important when compare with the default Docker-based solution, eg dind or kind. It also works much better than native molecule-libvirt because of Vagrant box supporting.

@jonashackt
Copy link

jonashackt commented Feb 24, 2020

Wow thanks so much @hswong3i - got Vagrant to run on TravisCI (with libvirt & KVM), this is absolutely amazing - I had to create my own example project to see it in action: https://github.com/jonashackt/vagrant-travisci-libvrt What did not work until now is the VirtualBox version of that setup (see https://github.com/jonashackt/vagrant-travisci) - are you really sure, VirtualBox will also work?

Either way, with that setup together with the generic Vagrant Boxes from Vagrant Cloud that support both libvirt and virtualbox providers at the same time, a really nice possibility to work with Vagrant locally and on CloudCI jobs is available finally!

@ssbarnea
Copy link
Member

I released v0.2 which is fixing most of the known issues, including this.

@westurner
Copy link
Author

westurner commented Feb 26, 2020 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
6 participants