Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(public-key): automatically add public key to vm #539

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ rabbitmq_password = "password"

sphinxsearch_version = "rel22" # rel20, rel21, rel22, beta, daily, stable

# SSH public key
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip

Vagrant.configure("2") do |config|

Expand Down Expand Up @@ -125,6 +127,14 @@ Vagrant.configure("2") do |config|
config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
end

# Add SSH public key to authorized_keys
config.vm.provision "shell" do |s|
s.inline = <<-SHELL
echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
echo #{ssh_pub_key} >> /root/.ssh/authorized_keys
SHELL
end

# If using VirtualBox
config.vm.provider :virtualbox do |vb|

Expand Down