Skip to content

Instantly share code, notes, and snippets.

@sbailliez
Created May 9, 2013 03:05
Show Gist options
  • Save sbailliez/5545294 to your computer and use it in GitHub Desktop.
Save sbailliez/5545294 to your computer and use it in GitHub Desktop.
require 'etc'
ssh_user = Etc.getlogin
public_key_path = "~/.ssh/id_dsa.pub"
ssh_public_key = File.read(File.expand_path(public_key_path)).strip
Vagrant.configure("2") do |config|
....
config.vm.provision :shell, :inline => "cat >>/tmp/ssh_key_pub <<EOF\n#{ssh_public_key}\nEOF"
config.vm.provision :shell, :inline => "cat >>/tmp/ssh_user <<EOF\n#{ssh_user}\nEOF"
config.vm.provision :shell, :path => "provision-user.sh"
..
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment