Hey Abhishek,

If you can share that shell script with me, by using which you were 
assigning dynamic hostname to Vagrant VM, than it will be really helpful.
I am eagerly waiting for a reply from you, and other members also who are 
part of this conversation.

Gmail - sukhdeepsinghghum...@gmail.com
Mobile- 7986186510

Regards,
Sukhdeep Singh

On Saturday, May 6, 2017 at 12:44:36 PM UTC+5:30 abhishe...@uptopoint.com 
wrote:

> Hey Guys , 
> Thanks alot for your help.
> Finally I found many ways to do the same thing. 
> 1. As Alvaro suggested, write to a temp file, 
> 2. or use Script inside VagrantFile to write to temp file
> 3. Create a script inside vagrant machine which runs on bootup , and 
> repackage vagrant machine 
> 4. use provisioning and create a shell script next to VagrantFile which 
> runs on bootup and configures the machine.
>
> I went with number 4. (because i had to use macaddress not random numbers).
> Although I wanted to set it up inside VagrantFile so machine has hostname 
> before bootup, but I couldnt find out way to get macaddress and create a 
> hostname string in VagrantFile. (New to Vagrant and dont know Ruby.)
>
> But never mind, i got what I want .
>
> Thanks to you all again.
>
> Regards,
> Abhishek
>
>
> On Wed, May 3, 2017 at 11:41 AM, Alvaro Miranda Aguilera <kik...@gmail.com
> > wrote:
>
>> try something like this:
>>
>> Vagrant.configure("2") do |config|
>>
>>   File.open("hostname.txt", "w") {|f| 
>> f.write("dummy-ngs-#{SecureRandom.random_number(9999)}")} unless 
>> File.file?("hostname.txt")
>>
>>   hostname = File.read("hostname.txt")
>>
>>
>>   config.vm.hostname = hostname
>>
>>   config.vm.box = "hashicorp/precise64"
>>
>> end
>>
> -- 
>>
> This mailing list is governed under the HashiCorp Community Guidelines - 
>> https://www.hashicorp.com/community-guidelines.html. Behavior in 
>> violation of those guidelines may result in your removal from this mailing 
>> list.
>>  
>> GitHub Issues: https://github.com/mitchellh/vagrant/issues
>> IRC: #vagrant on Freenode
>> --- 
>>
> You received this message because you are subscribed to a topic in the 
>> Google Groups "Vagrant" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/vagrant-up/rXpN5TCCFUo/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> vagrant-up+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/vagrant-up/CAHqq0eybpdJxaazonwk5ZbQX8QrW%2BW-z5FDZH%3DJq5LWbXGMJSg%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/vagrant-up/CAHqq0eybpdJxaazonwk5ZbQX8QrW%2BW-z5FDZH%3DJq5LWbXGMJSg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>
>
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/vagrant/issues
Discuss: https://discuss.hashicorp.com/c/vagrant/24
--- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/eea02831-634e-44a6-a173-8c70603a63fcn%40googlegroups.com.

Reply via email to