Use Vagrant trigger to execute bash script on host
You can run your script directly using the run
instructions
[:up, :provision].each do |cmd|
config.trigger.before cmd, stdout: true do
run "Vagrant_trigger_before.sh"
end
end
After trigger plugin was merged to vagrant mainline, the syntax seems to be changed to
config.trigger.before :up, :provision do |trigger|
trigger.run = {inline: "Vagrant_trigger_before.sh"}
end
Ref: https://www.vagrantup.com/docs/triggers/configuration#inline