Skip to content

Instantly share code, notes, and snippets.

@gaffneyc
Created January 25, 2012 18:24
Show Gist options
  • Select an option

  • Save gaffneyc/1677730 to your computer and use it in GitHub Desktop.

Select an option

Save gaffneyc/1677730 to your computer and use it in GitHub Desktop.
# Would love to do this with chef
directory("/home/gaffneyc") do
uid "gaffneyc"
gid "gaffneyc"
mode "0700"
directory(".ssh") do
# implies uid, gid, and mode
template("authorized_keys") do
...
end
end
end
@mattray
Copy link

mattray commented Jan 25, 2012

unfortunately this is about as good as you can do without digging into how Resource is coded in Ruby and changing it

["/home/gaffneyc", "/home/gaffneyc/.ssh"].each do |dir|
directory dir do
uid "gaffneyc"
gid "gaffneyc"
mode "0700"
end
end

template("/home/gaffneyc/.ssh/authorized_keys") do
source "authorized_keys.erb"
owner "gaffneyc"
group "gaffneyc"
mode "0644"
end

@gaffneyc
Copy link
Author

@mattray: Yeah, that's essentially what I'm doing right now. I'm thinking this would be a nice addition to the dsl but no clue what it would take to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment