-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add a disk #60
Comments
It has to be done through provider specific options. For instance, with vagrant libvirt (I don't have virtualbox example at hand):
|
That's helpful. But there is still some confusion, sorry. What are the provider_raw_config_args used to represent? libvirt options (when used as a provider), virtualbox command line args, or vagrant configuration? Any basic example for virtualbox would be helpful. Currently I'm using libvirt as the provider since I thought it seemed the preferred method, would it make more sense for me to use virtualbox directly as the provider? Is there any benefit in using libvirt over virtualbox for virtualbox VMs. |
The options set in the platform definition are used to write the I've not tested it but I guess something like this may work for virtualbox provider. The idea is to use the
molecule-vagrant doesn't force to use a provider. The only thing to note is that only virtualbox and libvirt providers are tested by the continuous integration. So, if you want to use virtualbox directly without going through libvirt, you can. |
This almost works, slight modification for anyone who needs it:
However, apparently there is an unrelated issue with WSL2 and virtualbox that prevents the port forwarding to the port 2222 on the vm to function properly. I have not been able to get past this so I'm going to punt and try to use Hyper-V instead, if you have a basic hyperv example that would be appreciated however, it seems that vagrant can't select the network switch for hyperv and so prompts every time, I'm not sure how to work around that. So Hyper-V is also a bust for now. Also, if you're using WSL you won't be able to change the path, to the disk since it doesn't seem to get translated to the /mnt/c/... path format, and even if you do, it gets prepended with the $wsl path prefix that breaks the path. I'm going to spin up a VM and maybe try a VM in a VM, though I hate to go that way, my options are limited. |
here is how I connect two VirtualBox disks:
|
@markfaine did you manage to get the two disks working ? Can we close the bug ? |
This is what worked for me: provider_raw_config_args:
- "customize ['createmedium', 'disk', '--filename', 'example', '--size', '2048']"
- "customize ['storageattach', :id, '--storagectl', 'SCSI', '--port', '2', '--type', 'hdd', '--medium', 'example.vdi']" |
I've tested the configuration from #60 on a test system with virtualbox and managed to add disks to the VM. This results in examples in my draft PR : ansible-community/molecule-vagrant#172. To be a little bit more complete: using createmedium or createhd probably depends on the virtualbox version used. As concerns this bug, I'll close it when PR ansible-community/molecule-vagrant#172 is merged in one or an other form. |
On top of the issue @apatard mentioned, the biggest caveat of passing commands to VirtualBox directly is that you would have to write some extra code to clean up. And running I found it best to use Vagrant to configure extra disks. One line to add a 10GB disk that will be managed by Vagrant: instance_raw_config_args:
- 'vm.disk :disk, name: "mySmallDisk", size: "10GB"' Vagrant documentation: https://developer.hashicorp.com/vagrant/docs/disks/configuration |
I reviewed the docs but didn't see anyway to configure an additional disk. I need to test an LVM role and I need a second disk device. Is this possible?
The text was updated successfully, but these errors were encountered: