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?
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.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With