-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow vagrant to execute scripts on host #4040
Comments
There's already been talks on integrating vagrant-triggers into core #3849 Should cover your needs. |
Are triggers detached from the vagrant lifecycle (up, down, status, ..)? When you run a standalone script, you sometimes want to manage the vagrant lifecycle from that script. With triggers it seems as though a script would only get executed as part of a lifecyle event? |
@snowch Triggers react to lifecycle events, yes. |
Ah, so triggers are probably not suitable for the use cases that I'm thinking of then. |
Tagged as enhancement. I think this is a good idea. Instead of just Ruby, any shell script is probably a good idea. |
It would be good to be able to execute any type of script, but I guess the main benefit of ruby over other shell scripts is that vagrant comes with an embedded ruby environment so you can guarantee your ruby script will always work on all host without having to install any other script interpreters. |
Hi all, You can use Vagrant's embedded Ruby which lives at While we could expose this as a command, I don't think we want to encourage users to rely on Vagrant's internal language over time. While it's true that Vagrant is written in Ruby and packages a Ruby environment, I don't think we want to tie ourselves to that promise at this time. Thanks! 😄 |
Some more complex vagrant environments require scripts to automate the workflow of vagrant for users. Usually, these scripts will be created with shell and batch files. An example bat file here and example shell script here
It would be great if I vagrant box providers could write scripts in ruby and use the vagrant's ruby environment to run the script. For example;
vagrant script setup_environment_with_desktop.rb
or
vagrant script setup_environment_without_desktop.rb
Using ruby will allow vagrant box providers to use the same script on all hosts operating systems.
The script would not be part of vagrant's life-cycle. It would purely be a mechanism for easily executing simple ruby scripts.
The text was updated successfully, but these errors were encountered: