Created
February 26, 2016 09:50
-
-
Save kesonno/11c458caea4698345d56 to your computer and use it in GitHub Desktop.
Ask for user input in Vagrantfile during provisioning phase
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
if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/#{VM_NAME}/*").empty? || ARGV[1] == '--provision' | |
print "Please insert your credentials\n" | |
print "Username: " | |
username = STDIN.gets.chomp | |
print "Password: " | |
password = STDIN.noecho(&:gets).chomp | |
print "\n" | |
config.vm.provision :shell, :path => "provision-vagrant.sh", :args => [username, password] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Super helpful, thanks! I used this basic idea to create shared folders for two related repos in the same VM: