Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print message after booting vagrant machine with "vagrant up"

I need to display a message on the completion of the vagrant up command.

I've tried defining a function:

def hello
    puts 'hello'
end

And then calling it and the end of the file:

hello 

But it always prints at the beginning of the output rather than the end. How can I print a message at the end?

like image 678
Roman Iuvshin Avatar asked Jun 13 '15 16:06

Roman Iuvshin


People also ask

How do I check my vagrant status?

Command: vagrant status [name|id] This will tell you the state of the machines Vagrant is managing. It is quite easy, especially once you get comfortable with Vagrant, to forget whether your Vagrant machine is running, suspended, not created, etc. This command tells you the state of the underlying guest machine.

What does vagrant up -- provision do?

Provisioners in Vagrant allow you to automatically install software, alter configurations, and more on the machine as part of the vagrant up process. This is useful since boxes typically are not built perfectly for your use case.


1 Answers

Vagrant now has builtin support for a message to appear after vagrant up. Just add this to your Vagrantfile:

config.vm.post_up_message = "This is the start up message!"

And then after your VM has come up you'll see this message in green:

==> default: Machine 'default' has a post `vagrant up` message. This is a message
==> default: from the creator of the Vagrantfile, and not from Vagrant itself:
==> default:
==> default:     This is the start up message!
like image 64
Cory Klein Avatar answered Oct 08 '22 13:10

Cory Klein