Last active
August 29, 2015 14:02
-
-
Save kokuyouwind/616de01321505c9fbffa to your computer and use it in GitHub Desktop.
ConoHa VPS Setup Recipes 01
This file contains 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
user_name = node['user']['name'] | |
ssh_key = node['user']['ssh_key'] | |
home = "/home/#{user_name}" | |
user username do | |
shell "/bin/zsh" | |
home home | |
password nil | |
supports :manage_home => true | |
end | |
group "wheel" do | |
action [:modify] | |
members user_name | |
append true | |
end | |
directory "#{home}/.ssh" do | |
owner user_name | |
group user_name | |
end | |
authorized_keys_file = "#{home}/.ssh/authorized_keys" | |
file authorized_keys_file do | |
owner user_name | |
mode 0600 | |
content "#{ssh_key} #{user_name}" # ファイルの中身を直接指定 | |
not_if { ::File.exists?("#{authorized_keys_file}")} # 既にファイルが存在していたらリソースを実行しない | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment