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

Vagrant provider agnostic setup #340

Merged
merged 1 commit into from
Oct 16, 2015
Merged

Vagrant provider agnostic setup #340

merged 1 commit into from
Oct 16, 2015

Conversation

ckovey
Copy link
Contributor

@ckovey ckovey commented Sep 7, 2015

This allows Trellis to be provider agnostic without losing any functionality. I've tested on Windows 8.1 with VMWare Workstation 11 using Vagrant 1.7.4

when /darwin/ then `sysctl -n hw.ncpu`.to_i
when /linux/ then `nproc`.to_i
else 2
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you restore this formatting/indentation to what it was?

@swalkinshaw
Copy link
Member

@ckovey thanks for this. Just had a couple minor style issues. Would you be able to squash commits once it's ready?

@ckovey ckovey force-pushed the master branch 2 times, most recently from 81e76dc to 4e72c47 Compare September 7, 2015 21:48
@ckovey
Copy link
Contributor Author

ckovey commented Sep 7, 2015

Fixed style issues and squashed everything up, sorry about that @swalkinshaw !

@austinpray
Copy link
Contributor

Wanna add VMware fusion while we are at it? I have a license I can test with.

@ckovey
Copy link
Contributor Author

ckovey commented Sep 8, 2015

@austinpray would you mind trying it as is? Supposedly the different VMware provider names were unified into vmware_desktop

hashicorp/vagrant#5227 (comment)

@austinpray
Copy link
Contributor

@ckovey I see! I'll test it tomorrow then

@austinpray
Copy link
Contributor

Something isn't right:

image

The virtualbox provider should be using ubuntu/trusty64 right?

@ckovey ckovey force-pushed the master branch 3 times, most recently from c41fc19 to 145c31c Compare September 10, 2015 14:40
@ckovey
Copy link
Contributor Author

ckovey commented Sep 10, 2015

I changed the box url to use the override way of doing things in their example: https://docs.vagrantup.com/v2/providers/configuration.html.

Then it seemed like vmware_desktop only applies to boxes and not Vagrant configs as my windows machine would try and load the virtualbox ubuntu/trusty64 using the override method. I guess somehow before it was simply taking the last config.vm.box defined as that would explain how mac was still trying to load the puppetlabs box. I added vmware_workstation and vmware_fusion blocks.

Finally DRY'd the memory setting out to be with CPU setting.

Tested this on my Win 8 VMware and MBP with Virtualbox. I don't have fusion if you want to try again

@swalkinshaw
Copy link
Member

@ckovey looks great. We'll eventually need to add some documentation that we support other providers now but this is still good for now.

@swalkinshaw
Copy link
Member

@ckovey could you rebase this? should be good to go after that.

@ckovey ckovey force-pushed the master branch 2 times, most recently from f615efa to 10455bb Compare October 10, 2015 21:03
@ckovey
Copy link
Contributor Author

ckovey commented Oct 10, 2015

@swalkinshaw rebased, thanks. Looks like someone figured out how to get Windows CPU count, nice!

@heyfletch
Copy link
Contributor

Does this mean Trellis can work with Parallels?

@swalkinshaw
Copy link
Member

@merchantguru it should.

@heyfletch
Copy link
Contributor

Parallels works with a few tweaks. Errors I got:

  1. "The box you're attempting to add doesn't support the provider you requested. Please find an alternate box...."

Using parallels/ubuntu-14.04 instead of ubuntu/trusty64 worked.

  1. "The specified host network collides with a non-hostonly network! This will cause your specified IP to be inaccessible. Please change the IP or name of your host only network so that it no longer matches that of a bridged or non-hostonly network."

I changed
config.vm.network :private_network, ip: '192.168.50.5' to
config.vm.network :private_network, ip: '192.168.1.200'

Not sure if you'd want to make a change like that to the default Trellis Vagrantfile or what.

Rather than throwing an error for non-Virtualbox users, setup the additional providers.
Neither the Ubuntu or Hashicorp Atlas users provide boxes for VMWare or Parallels so we
must fall back to a no configuraiton management box provided by Puppet Labs

For Windows users using a non-standard provider/box like VMWare we must check that
add-apt-repository is installed before trying to use it
@ckovey
Copy link
Contributor Author

ckovey commented Oct 15, 2015

Thanks @merchantguru, I did not have Parallels to test so I just made an assumption with the box. I've updated the commit with the parallels/ubuntu-14.04 base you found if you want to try again fresh.

re the IP error. This I believe is because you have multiple Trellis installations going or some other device/VM on that IP in your network. The master version of Vagrantfile specified the IP https://github.com/roots/trellis/blob/master/Vagrantfile and I have not changed that here. You should get the same error if you closed the master repo twice and tried to vagrant up on each. So I believe this part would be "out of scope" for this PR

@swalkinshaw
Copy link
Member

@merchantguru awesome, thanks for testing.

I agree about the networking error. Unless that error would happen on a standard first Trellis install then we shouldn't worry about it.

@heyfletch
Copy link
Contributor

OK @ckovey, @swalkinshaw, I've retested and Parallels works flawlessly. Thanks for making this provider agnostic!

swalkinshaw added a commit that referenced this pull request Oct 16, 2015
Vagrant provider agnostic setup
@swalkinshaw swalkinshaw merged commit 2c12391 into roots:master Oct 16, 2015
@swalkinshaw
Copy link
Member

@ckovey thanks for this!

swalkinshaw added a commit that referenced this pull request Oct 16, 2015
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

Successfully merging this pull request may close these issues.

4 participants