chefでgitのdeploy key使うサンプル
deploy keyを使ったりするサンプル privateでも使える
stackoverflowで見かけたやつにちょっと手を入れてます
ssh_configにgithubの接続先書きわけてもいいんですけど単一のrecipeにぺぺっとコピペする用
deploy keyだけfiles/に置いて上三行書き換えれば使えるはず。。。
private_repository = "git@github.com:org/repo.git" deploy_directory = "/opt/toolname" source_ssh_deploykey = "github-deploy.pem" github_ssh_wrapper = "/root/.ssh/github_git_wrapper_#{source_ssh_deploykey}.sh" github_ssh_deploykey = "/root/.ssh/#{source_ssh_deploykey}" cookbook_file "#{github_ssh_deploykey}" do source "#{source_ssh_deploykey}" mode 0600 end file "#{github_ssh_wrapper}" do mode 0755 content "#!/bin/sh\nexec /usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i #{github_ssh_deploykey} \"$@\"" end package "git" do action :install end git "#{deploy_directory}" do repository "#{private_repository}" action :sync ssh_wrapper "#{github_ssh_wrapper}" end