[ssh] Setup SSH keys

pull/28/head
Alpha Chen 10 years ago
parent d3e810de6f
commit 62f4712ec8

@ -31,5 +31,5 @@
with_dict:
git/.gitignore: .gitignore
- name: setup ssh keys
local_action: ruby ~/.dotfiles/setup_ssh_keys.rb
local_action: command ruby ~/.dotfiles/scripts/setup_ssh_keys.rb
when: ansible_domain == "local"

@ -0,0 +1,21 @@
require 'fileutils'
include FileUtils
def with_mount(image)
out = `hdiutil mount #{image}`
mountpoint = out.split(/\s+/).last
yield(mountpoint)
ensure
puts `hdiutil unmount #{mountpoint}`
end
cd File.expand_path('~/.ssh')
with_mount "~/Dropbox/sekritz.sparseimage" do |mountpoint|
Dir["#{mountpoint}/ssh keys/*"].each do |file|
cp file, File.basename(file)
puts `chmod go-r #{File.basename(file)}`
puts `ssh-add -K #{File.basename(file)}`
end
end
Loading…
Cancel
Save