On Thu, Feb 5, 2015 at 10:39 PM, Nicola <[email protected]> wrote:
> nother question. I't's possible to generate a random hostname using the

Hello,

Not sure what you mean by random,. can you give an example? say
4345234534523462345623456235 ??

Vagrantfile is ruby code, so some basic ruby can be used inside.

you can setup the hostname with

config.vm.hostname = "myawesomebox"

that will set the hostname inside the box.

I use this to set the time stamp as part of the name of the vm in the
gui for virtualbox:

vm_name_app = "collaba" do |config|
  config.vm.hostname = "#{vm_name_app}.racattack"
  config.vm.provider :virtualbox do |vb|
    vb.name = vm_name_app + "." + Time.now.strftime("%y%m%d%H%M")
  end
end

if a timestamp works for you, since you won't be starting 2 vms at the
same time, you may try that

config.vm.hostname = Time.now.strftime("%y%m%d%H%M%S")


if this doesn't work for you.. provide an example of what you mean by
random.. on the mailing list are very clever guys that have high
ruby-fu, so they can provide some better ideas

Alvaro.

-- 
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.

Reply via email to