Vagrant VMWare Plugin - Show VM in VMWare Workstation - vagrant

I'm using Vagrant with the VMWare plugin. I've noticed that VMs upped using Vagrant are not displayed automatically in the VMWare Workstation GUI.
I can (manually) open them using File->Open... and selecting the .vagrant\machines\puppet\vmware_workstation\some-unique-id...vmx file. But that's a bit annoying. Using VirtualBox, vagrant VMs are automatically added and removed from the Virtualbox GUI.
Am I missing something or is that just not supported for VMWare boxes?
Reaons why I'm not just sticking with vagrant commands:
To quickly see which machines are running (I have multiple machine setups and yes, I know vagrant status does the same...)
To create and restore snapshots (I have a time consuming provisioning and sometimes it's nice to just restore to a snapshot while testing)

I didn't get #mmey's exact solution to work, but putting this in the Vagrantfile worked for me:
config.vm.provider "vmware_fusion" do |v|
v.gui = true
end
Documentation

I don't think there's much to do about #1, it looks like VMWare limitation.
However you can use this Vagrant plugin to add snapshot ability from the command line.

I found the (not so surprising) answer to my question: Just disable headless mode by setting config.vm.provider.gui=true in the Vagrantfile (as described at https://docs.vagrantup.com/v2/vmware/configuration.html).

Related

Can you perform a vagrant provision from inside the VM?

Usually you have to run vagrant provision from outside your VM to create the VM to begin with. I then do a vagrant ssh to inspect the resultant VM.
If I wish to make small tweaks to the VM (using chef zero recipes in my case), I have to either switch to an other tab that is on my physical host, or exit the SSH session. it would be nice if you could do this run-and-inspect inside the previously created VM.
Why I'm asking: I have too many terminal tabs open for development and am looking for ways to prune, and avoid mental context switching (not to mention trying to figure out which tab is which).
No, you can not run a vagrant provision from inside the same vagrant machine.
Vagrant is running on your host and provisioning the VM according to the specified vagrantfile. Any changes that you want to have applied during the provisioning must somehow come from the vagrantfile.
What you can do is modify a running vagrant machine in any way you want from inside the vagrant machine, and then export the VM using vagrant package to a new vagrant box which then can be used as base for new vagrant VMs.
PS: Not sure how you're dev environment looks like, but I suggest you look into terminal multiplexers like GNU screen or tmux, that might be able to help you with your "tab issues".

Vagrant + multiple providers for different work environments

Hello Vagrant experts out there!
I ran into a bit of a problem.
I'm trying to setup a vagrantfile with centos environment using virtualbox as a provider and it seems to work great.
So whats the problem?
One of our developers is working behind qemu on linux.
When trying to run the current vagrantfile with virtualbox it collides with libvirt, they refuse to work together.
Is there a way to write a single Vagrantfile for different work environments?
Meaning when I run the file on a machine with virtualbox installed it will run with a virtualbox provider and when running on a different machine with qemu it will run with qemu as a provider?
If not - is there a smarter way to do it?
I guess I'm not the only one out there the encountered the issue..
Thanks
I'm assuming you're using 3rd party provider (like vagrant-libvirt).
Vagrant documentation is mentioning that you can select default provider in couple of ways:
Set VAGRANT_DEFAULT_PROVIDER env variable.
Use vagrant up --provider
Set multiple config.vm.provider options. The first available will be used.

Running vagrant on two macs

I have Vagrant installed on my iMac but I would also like to install and run it on my MacBook. Is it possible to run the same Vagrant box across two Macs?
I have done a Vagrant up command within a shared Dropbox folder - so i'm guessing that all I need to do is install vagrant on the second mac and then navigate to the Dropbox shared folder and do vagrant up.
Would this work?
Known solution:
ssh to the host machine
user#MacBook: ssh user#imac
then vagrant up; vagrant ssh.
user#imac: vagrant up; vagrant ssh
vagrant#vagrantvm:
This would be the most straight forward way I can think of.
Another option:
RDP to imac and run vagrant up;vagrant ssh as normal
Yet another option:
If your vagrant file is complete enough you should be able to vagrant up on any host to give you the same vagrant env. This relies on your use case but is how I use vagrant.
Vagrant stores the state of the machine and machine id inside the .vagrant folder. The running machine (vm) itself is handled by virtualbox/vmware or any provider your using. Lets say the virtualbox box is stored somewhere else on your system and referenced by Vagrant.
If you access the folder from two systems your basically remote controlling two different machine on two different systems. Not a good solution. Furthermore, you will run into problems if the states are different, e.g. its "up" on system one but "destroyed" on system two.
Additionally to the above solutions I propose the following:
Vagrant Share! Enable Vagrant http-/ssh-Share between your systems.
Vagrant machines should be repeatable and destroyable. Therefore, put your Vagrantfile under version control and checkout on the two systems.
Configure your provider to store the box itself on the dropbox.

Adding new VM's to VirtualBox via Mac terminal / usage with Vagrant

I'm just getting started with using VirtualBox. I'm trying to do all my work GUI free, i.e. only using iTerm2, and want to work with different VM's command terminal's via Vagrant. So my questions are:
How or what is the process/command to add different VM's to my VirtualBox that are each using the vagrant feature?
When starting vagrant using the command: vagrant up, how do i specify which VM i want to use?
I have looked at different explanations, e.g. the vagrant and virtualbox websites, but they seem a bit too specific to a certain case. My employer already setup Debian successfully and it is compatible with vagrant but I am not exactly sure how that was done or what the folder locations mean.

docker does not run on windows error

I've installed docker and followed the directions here: https://docs.docker.com/installation/windows/#installation but when I run boot2docker start this happens:
Trying to get IP one more time
exit status 255
Docker client does not run on Windows for now. Please use
"boot2docker" ssh
to SSH into the VM instead
Trying boot2docker ssh results in the same 255 error. I tried to get the VM IP with boot2docker IP but that also yielded nothing - I presume because boot2locker wasn't successful in the start process.
A couple of observations...I lloked at the vm settings and there wasn't any network or storage settings specified and the memory allocation in the vm settings didn't match the values in the config (boot2docker config). The boot2docker start/stop commands work.
I'm stumped.
I observed similar issue. Following steps helped me:
Open VirtualBox GUI.
Remove boot2docker-vm virtual machine.
Start Boot2Docker Start --- it will recreate boot2docker-vm virtual machine.
We had exactly this on someone's machine.
The solution for us was to find the
Run the VirtualBox UI (C:\program files\oracle....)
locate the VM (at the top)
select 'power off'
Once all that was done, boot2docker started correctly again.
In extremis, you could delete the boot2docker-vm image out of virtualbox, and it ought to re-install it.
go to the Oracle VM VirtualBox Manager, power off boot2docker-vm and start again. It worked for me.
just in case it helps. My problem was because boot2docker's default settings is beyond my laptop's capability (I know). I fixed the problem by changing the properties of boot2docker-vm through the VirtualBox GUI. Soon as I open thr properties I saw a few warnings at the bottom of the dialogue box, so I followed the hint and resolve those warnings, save the setttings and was able to start docker then.
I changed the CPU from 4->1, memory from 2G to 1.5G and video memory to 20M. Hope it helps.
Mostly you didn't enable the "Virtualization" in your BIOS. boot2docker needs to install 64bit OS in Virtualbox.
Its worth noting I had some huge problems trying to run docker on windows. Boot2docker would install OK with VritualBox 4.3.20. I could NOT run boot2docker or docker itself.
It took me ages to figure out that I had uninstall VirtualBox 4.3.20 and use 4.3.12 instead which worked first time like a treat!
So.. for Windows boot2docker only use VirtualBox 4.3.12.

Resources