Hoping someone can help me out here.
I am wanting to create aliases on my local machine (host) when running vagrant up
. Through my search for vagrant run command on host, I came across the vagrant-triggers
plugin. From the surface it appears to do exactly what I want (executing a script/command on the host machine during the vagrant provisioning process), however I have not been able to get it working successfully.
Below is my example code. I don't receive any errors, but the aliases are not available on the host.
Vagrant.configure("2") do |config|
# Your existing Vagrant configuration
...
# start vagrant-triggers example code
{
:up => [
'alias runscript="$(PWD)/script"',
'alias runscript2="$(PWD)/script2"'
],
[:halt, :destroy] => [
'unalias runscript',
'unalias runscript2'
]
}.each do |trigger, commands|
config.trigger.after trigger, :stdout => true do
commands.each do |command|
run command
end
end
end
...
end