emyl / vagrant-triggers

Allow the definition of arbitrary scripts that will run on the host before and/or after Vagrant commands.
MIT License
546 stars 35 forks source link

Execute specific provisioner after trigger #22

Closed boesing closed 10 years ago

boesing commented 10 years ago

Hi,

I want to use your module to override "vagrant destroy".

This actually works like a charm, but now I've wrote a special puppet uninstall manifest to ensure that some files are being deleted from my machine. Is there any way of doing that?

I am using puppet already for provisioning, as I've read, there is a way to override the manifest file in that provisioner configuration. So my goal is, catching vagrant destroy, change the manifest to my uninstall one and running the provisioner after that.

Any suggestions?

boesing commented 10 years ago

As of explained in mitchellh/vagrant Issue-Ticket, I want to uninstall my project data instead of destroying the whole machine.

emyl commented 10 years ago

Something like the following should work for your use case:

config.trigger.instead_of :destroy, :stdout => true do
  run_remote "puppet apply --modulepath /tmp/vagrant-puppet-0/modules-0 /tmp/vagrant-puppet-0/manifests/uninstall.pp"
end