Last active
June 27, 2018 08:28
-
-
Save madsmtm/736d09eb5fc5087294fa569e0dc70f3d to your computer and use it in GitHub Desktop.
Conditional Vagrant Provisioner
This file contains 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
# When you type 'up' the first time, it's always updated | |
config.vm.provision 'update', type: 'shell', inline: "apt-get update;apt-get -yq upgrade" | |
# When you provision the machine, you're asked whether you want to update it | |
if ARGV.include?('up') or ARGV.include?('reload') or ARGV.include?('resume') and ARGV.include?('--provision') or ARGV.include?('provision') | |
print 'Do you want to update the server (y/n)? ' | |
if STDIN.gets.chomp.downcase != 'y' | |
config.vm.provision 'update', type: 'shell', inline: '' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment