Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add option for extra SSH keys.

  • Loading branch information...
commit 58f16e4feeafca764c65591438d9d91891cab7fc 1 parent 928ed49
@roidrage roidrage authored
View
13 worker_host/users/recipes/default.rb
@@ -56,7 +56,18 @@
end
end
+ ssh_keys = {}
if user[:ssh_key]
+ ssh_keys[user[:id]] = user[:ssh_key]
+ end
+
+ if user[:extra_ssh_keys]
+ user[:extra_ssh_keys].each do |user_id|
+ ssh_keys[user_id] = users.find{|user| user[:id] == user_id}[:ssh_key]
+ end
+ end
+
+ if ssh_keys.any?
directory "#{user[:home]}/.ssh" do
mode "0700"
owner user[:id]
@@ -69,7 +80,7 @@
owner user[:id]
group primary_group
source "authorized_keys.pub"
- variables :ssh_key => user[:ssh_key]
+ variables :ssh_keys => ssh_keys
end
end
end
View
5 worker_host/users/templates/default/authorized_keys.pub
@@ -1 +1,4 @@
-<%= @ssh_key %>
+<% @ssh_keys.each do |name, key| %>
+# <%= name %>
+<%= key %>
+<% end %>
Please sign in to comment.
Something went wrong with that request. Please try again.