Created
April 3, 2013 11:58
-
-
Save jeekl/5300590 to your computer and use it in GitHub Desktop.
simple example of adding a user and ssh key in chef
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
username = "foo" | |
homedir = "/home/#{username}" | |
user username do | |
action :create | |
comment "foo user" | |
home homedir | |
supports :manage_home => true | |
end | |
directory "#{homedir}/.ssh" do | |
owner username | |
group username | |
end | |
template "#{homedir}/.ssh/id_rsa" do | |
source "id_rsa.erb" | |
owner username | |
group username | |
mode 0600 | |
not_if { File.exists?("#{homedir}/.ssh/id_rsa") } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment