From 1948f1862fa30ae57b8ba91f8fdc66641cbdc078 Mon Sep 17 00:00:00 2001
From: Bo-Chun Louis Chen <louistw@uab.edu>
Date: Mon, 7 Jan 2019 11:23:02 -0600
Subject: [PATCH] Setup vagrant to use existing ssh key

Set insert_key to false, prevent vagrant from generating new key
then set our own ssh private key to be used, first priority
finally, copy our own ssh public key into vm as authorized key
---
 Vagrantfile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Vagrantfile b/Vagrantfile
index 38bd4e3..03c6630 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -22,12 +22,15 @@ Vagrant.configure("2") do |config|
       auto_correct: true
   end
 
-
   config.vm.provider :virtualbox do |vb|
     vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
     vb.memory = "2048"
   end
 
+  config.ssh.insert_key = false
+  config.ssh.private_key_path = ["~/.ssh/id_rsa", "~/.vagrant.d/insecure_private_key"]
+  config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/authorized_keys"
+
   config.vm.provision "shell", inline: <<-SHELL
     if [ -f /vagrant/localenv.sh ]; then
       . /vagrant/localenv.sh
-- 
GitLab