Created
April 16, 2014 17:42
-
-
Save wkf/10912251 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A provisioner to allow reloading of a Vagrant VM during provisioning. | |
| # | |
| # This file should be placed into the same folder as your Vagrantfile. Then in | |
| # your Vagrantfile, you'll want to do something like the following: | |
| # | |
| # ---------------------------------------------------------------------------- | |
| # | |
| # require './vagrant-provision-reboot-plugin' | |
| # | |
| # Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
| # | |
| # # Run your pre-reboot provisioning block. | |
| # #config.vm.provision :chef_solo do |chef| | |
| # # ... | |
| # #end | |
| # | |
| # config.vm.provision :reload | |
| # | |
| # # Run your post-reboot provisioning block. | |
| # #config.vm.provision :chef_solo do |chef| | |
| # # ... | |
| # #end | |
| # | |
| # ---------------------------------------------------------------------------- | |
| require 'vagrant' | |
| class ReloadPlugin < Vagrant.plugin('2') | |
| name 'Reload Plugin' | |
| # This plugin provides a provisioner called unix_reboot. | |
| provisioner 'reload' do | |
| # Create a provisioner. | |
| class ReloadProvisioner < Vagrant.plugin('2', :provisioner) | |
| # Initialization, define internal state. Nothing needed. | |
| def initialize(machine, config) | |
| super(machine, config) | |
| end | |
| # Configuration changes to be done. Nothing needed here either. | |
| def configure(root_config) | |
| super(root_config) | |
| end | |
| # Run the provisioning. | |
| def provision | |
| @machine.action('reload', :provision_enabled => false) | |
| end | |
| # Nothing needs to be done on cleanup. | |
| def cleanup | |
| super | |
| end | |
| end | |
| ReloadProvisioner | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment