As Alvaro said, the easiest way is through ENV variable magic. You can prefix your vagrant up with some instance ENV vars and then access those via the ENV call he outlined.
ENV1=prod ENV2=official vagrant up If you are more comfortable with ruby you could also do some rudimentary argument parsing, but that could easily bump into vagrant's arg parsing, so the other option if ENV isn't your bag, would be having a file with the options you want to use, and then use Ruby to read in the options from the file, this file could be something like dev-env / prod-env and you have a copy with different variables depending on your branch (if you are using the Vagrantfile from a code repo). On Thursday, April 9, 2015 at 2:30:23 AM UTC-5, Jim Klo wrote: > > Relatively new to Vagrant as well as Ruby. > > I've got a multi-box Vagrantfile and wondering if there's a way for me to > pass additional command-line arguments to vagrant-up that I can process > within the Vagrantfile. > > For example, I've got a VM that provisions a server by default against a > specific official release of a source repo, however I'd like to have the > ability to just pass an argument or flag that can be processed to do some > additional provisioning by changing the source repo to different branch. I > suppose I could do this using subsequent calls after the vagrant-up with > vagrant-ssh, but was hoping to have a handy one-liner. > > Thanks, > > - Jim > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
