replace _ with - on the name
Vagrant.configure(2) do |config|
vm_name ||= "vagrant-dev#{rand(01..99)}.local.domain"
config.vm.box = "kikitux/oracle6"
config.vm.hostname = vm_name
end
On Fri, Feb 6, 2015 at 12:03 AM, Nicola <[email protected]> wrote:
> This is the result:
>
> vm:
> * The hostname set for the VM should only contain letters, numbers,
> hyphens or dots. It cannot start with a hyphen or dot.
>
> I've tried that script in a lot of different way, but I've always an error.
>
> Nicola
>
> Il giorno giovedì 5 febbraio 2015 11:40:26 UTC+1, Alvaro Miranda Aguilera ha
> scritto:
>>
>> On Thu, Feb 5, 2015 at 11:26 PM, Nicola <[email protected]> wrote:
>> > config.vm.hostname = "vagrant_dev#{rand(01..99)}.local.domain}"
>>
>> Yeah that works, you have an extra } at the end.
>>
>> take note the Vagrantfile is read top to botton and when you start
>> using blocks the vagrantfile can be read serveral times, specially if
>> you later puts loops, etc
>>
>> so I would use something like this to make sure the name is set once
>> for each read, so the variable have the same value if you end using
>> that on multiples lines of the Vagrantfile later
>>
>> Vagrant.configure(2) do |config|
>> vm_name ||= "vagrant_dev#{rand(01..99)}.local.domain"
>> config.vm.box = "kikitux/oracle6"
>> config.vm.hostname = vm_name
>> end
>>
>> 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.
--
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.