Generates and uploads SSH Deploy Keys to GitHub for your applications. This is helpful so if any one server is compromised, that one SSH key can be revoked and replaced.
- Will install httparty as a chef gem
- Requires Chef 0.11+ and supports Why-Run
- A client_id and client_secret from GitHub which are exchanged into client tokens. see later on this page on how to exchange them.
This is actually what does the work.
- :add - Add the key to GitHub.
path
The target for the secret key. The public key will be at path.pubowner
The user who owns the files, default: rootgroup
The group that owns the files, default: rootgh_token
The OAuth2 token, exchanged like below.gh_repo
The repo to add the key to, ie:company/repo
curl -i -X POST -d '{"scopes": ["repo"], "note": "deployments from chef"}' \
-u "githubuser:githubpassword"
https://api.github.com/authorizations?client_id=GHCLIENTID&client_secret=GHCLIENTSECRET
Then look for: "token": "...". This is what you want to use for 'gh_token'.
github_deploy_key "my-secret-app" do
path "/opt/my-secret-app/deploy"
owner "root"
group "root"
gh_token "..."
gh_repo "mycompany/my-secret-app"
end