Having access to the provider sounds useful, did anyone already create an issue for it? https://github.com/mitchellh/vagrant/issues
On Mon, Jul 21, 2014 at 10:09 PM, Benjamen Keroack <bkero...@gmail.com> wrote: > I just had to implement the hack from earlier in the thread (involving > ARGV). > > Basically I need to set a variable based on the provider name and use it > later on in provision blocks, but there's no way to do this in Vagrant > without that type of hack, unfortunately. Global variables > set in provider blocks are not visible outside the block. > > > On Wednesday, May 28, 2014 9:32:21 AM UTC-7, Brian Gonzalez wrote: >> >> >> You could also check the provider type from with the provider block, and >> set up some conditional config there: >> >> >> config.vm.provider "digital_ocean" do |provider| >> >> puts "* Using Digital Ocean Provider *" >> config.ssh.private_key_path = "~/.ssh/id_rsa" if provider.is_a? >> VagrantPlugins::DigitalOcean::Config >> >> provider.client_id = DIGITAL_OCEAN_CLIENT_ID >> provider.api_key = DIGITAL_OCEAN_API_KEY >> provider.image = "Ubuntu 13.10 x64" >> provider.region = "San Francisco 1" >> end >> >> >> >> On Tuesday, November 12, 2013 9:14:14 AM UTC-8, Teemu Matilainen wrote: >>> >>> On Tue, Nov 12, 2013 at 1:39 PM, Shawn Neal <neal....@gmail.com> wrote: >>> >>>> You can put something like this in your Vagrantfile: >>>> >>>> provider = (ARGV[2] || :virtualbox).to_sym >>>> >>> >>> The default provider can also be set by an environment variable: >>> >>> provider = (ARGV[2] || ENV['VAGRANT_DEFAULT_PROVIDER'] || >>> :virtualbox).to_sym >>> >>> >>>> While this works, I tend to avoid doing things like this. Instead I put >>>> things like this into a config file that is conditionally loaded if they >>>> exist or in environment variables. >>>> >>> >>> Yeah, that feels really fragile. =) >>> >>> -- >>> Cheers, >>> Teemu >>> >> -- > You received this message because you are subscribed to the Google Groups > "Vagrant" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vagrant-up+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.