Skip to content

Instantly share code, notes, and snippets.

Created November 22, 2016 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5c374e52b0fe9551043b01671683a3d7 to your computer and use it in GitHub Desktop.
Save anonymous/5c374e52b0fe9551043b01671683a3d7 to your computer and use it in GitHub Desktop.
# previous https://gist.github.com/anonymous/44eee71f0d07ca824ed01918b6126f84
ssh_config = my_config.vars.host_ssh_file
ssh_config_rm = "ssh-config-upsert rm #{machine_config.name} #{ssh_config}"
ssh_config_add = "ssh-config-upsert add #{ssh_config} \"vagrant ssh-config #{machine_config.name}\""
config.trigger.before :reload, :vm => [machine_config.name] do
run ssh_config_rm if ssh_config
run_remote "/vagrant/vagrant-triggers/vagrant-before-reload"
end
config.trigger.after :reload, :vm => [machine_config.name] do
run ssh_config_add if ssh_config
run_remote "/vagrant/vagrant-triggers/vagrant-after-reload"
end
config.trigger.after :up, :vm => [machine_config.name] do
run ssh_config_add if ssh_config
run_remote "/vagrant/vagrant-triggers/vagrant-after-up"
end
config.trigger.before :halt, :vm => [machine_config.name] do
run ssh_config_rm if ssh_config
run_remote "/vagrant/vagrant-triggers/vagrant-before-halt"
end
config.trigger.before :suspend, :vm => [machine_config.name] do
run ssh_config_rm if ssh_config
run_remote "/vagrant/vagrant-triggers/vagrant-before-suspend"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment