diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
| commit | 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch) | |
| tree | 158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/vagrant/triggers%2Findex.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/vagrant/triggers%2Findex.html')
| -rw-r--r-- | devdocs/vagrant/triggers%2Findex.html | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/devdocs/vagrant/triggers%2Findex.html b/devdocs/vagrant/triggers%2Findex.html deleted file mode 100644 index 9ec41dd22..000000000 --- a/devdocs/vagrant/triggers%2Findex.html +++ /dev/null @@ -1,52 +0,0 @@ -<h1 id="vagrant-triggers"> Vagrant Triggers </h1> <p>As of version 2.1.0, Vagrant is capable of executing machine triggers <em>before</em> or <em>after</em> Vagrant commands.</p> <p>Each trigger is expected to be given a command key for when it should be fired during the Vagrant command lifecycle. These could be defined as a single key or an array which acts like a <em>whitelist</em> for the defined trigger.</p> <div class="highlight"><pre class="highlight ruby" data-language="ruby"># single command trigger -config.trigger.after :up do |trigger| -... -end - -# multiple commands for this trigger -config.trigger.before [:up, :destroy, :halt, :package] do |trigger| -... -end - -# or defined as a splat list -config.trigger.before :up, :destroy, :halt, :package do |trigger| -... -end -</pre></div> -<p>Alternatively, the key <code>:all</code> could be given which would run the trigger before or after every Vagrant command. If there is a command you don't want the trigger to run on, you can ignore that command with the <code>ignore</code> option.</p> <div class="highlight"><pre class="highlight ruby" data-language="ruby"># single command trigger -config.trigger.before :all do |trigger| - trigger.info = "Running a before trigger!" - trigger.ignore = [:destroy, :halt] -end -</pre></div> -<p><strong>Note:</strong> <em>If a trigger is defined on a command that does not exist, a warning will be displayed.</em></p> <p>Triggers can be defined as a block or hash in a Vagrantfile. The example below will result in the same trigger:</p> <div class="highlight"><pre class="highlight ruby" data-language="ruby">config.trigger.after :up do |trigger| - trigger.name = "Finished Message" - trigger.info = "Machine is up!" -end - -config.trigger.after :up, - name: "Finished Message", - info: "Machine is up!" -</pre></div> -<p>Triggers can also be defined within the scope of guests in a Vagrantfile. These triggers will only run on the configured guest. An example of a guest only trigger:</p> <div class="highlight"><pre class="highlight ruby" data-language="ruby">config.vm.define "ubuntu" do |ubuntu| - ubuntu.vm.box = "ubuntu" - ubuntu.trigger.before :destroy do |trigger| - trigger.warn = "Dumping database to /vagrant/outfile" - trigger.run_remote = {inline: "pg_dump dbname > /vagrant/outfile"} - end -end -</pre></div> -<p>Global and machine-scoped triggers will execute in the order that they are defined within a Vagrantfile. Take for example an abstracted Vagrantfile:</p> <div class="highlight"><pre class="highlight plaintext">Vagrantfile - global trigger 1 - global trigger 2 - machine defined - machine trigger 3 - global trigger 4 -end -</pre></div> -<p>In this generic case, the triggers would fire in the order: 1 -> 2 -> 3 -> 4</p> <p>For more information about what options are available for triggers, see the <a href="configuration">configuration section</a>.</p><div class="_attribution"> - <p class="_attribution-p"> - © 2010–2018 Mitchell Hashimoto<br>Licensed under the MPL 2.0 License.<br> - <a href="https://www.vagrantup.com/docs/triggers/" class="_attribution-link">https://www.vagrantup.com/docs/triggers/</a> - </p> -</div> |
