LoginSignup
2
2

More than 5 years have passed since last update.

ItamaeでGithubからSSH公開鍵を取得する

Posted at

はじめに

新しくサーバにユーザを作るとき、メールで公開鍵送ってくれ、なんてことせずGithubからさくっと持ってこれると便利ですよね。

ItamaeでSSH公開鍵をセットするプラグインを公開したので、GithubからSSH公開鍵を持ってくる方法を紹介します。

Gemfile

SSHの取得にはitamae-plugin-resource-ssh_keyを使います。

Gemfile
source "https://rubygems.org"
gem "itamae-plugin-resource-ssh_key"

レシピ

nownabeというユーザを作って、Githubのnownabeユーザから公開鍵をもってくるにはこんな感じのレシピを作ります。

recipe.rb
require "itamae/plugin/resource/ssh_key"

user "nownabe"

ssh_key "nownabe" do
  github_user "nownabe"
end
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2