Itamae | ssh コマンドでリモートプロビジョニング #devops #itamae
概要
プロビジョニングツール Itamae
ssh コマンドでリモートプロビジョニング。
ssh コマンド仕様
ssh の help は以下。
$ itamae help ssh
Usage:
itamae ssh RECIPE [RECIPE...] -h, --host=HOST
Options:
-j, [--node-json=NODE_JSON]
-n, [--dry-run], [--no-dry-run]
-h, --host=HOST
-u, [--user=USER]
-i, [--key=KEY]
-p, [--port=N]
[--ohai], [--no-ohai]
[--vagrant], [--no-vagrant]
-l, [--log-level=LOG_LEVEL]
# Default: info
[--color], [--no-color]
# Default: true
Run Itamae via ssh
試行
仕様
- tree をインストールするだけのレシピを利用。
package "tree" do
action :install
end
- 対象サーバーは、 192.168.33.99 とする。
- user は vagrant
実行
# ssh コマンドでローカル環境からプロビジョニング実行
$ itamae ssh -h 192.168.33.99 -u vagrant recipe.rb
# 192.168.33.99 に ssh 接続して tree のインストール結果を確認
$ vagrant ssh
$ tree --version
tree v1.5.3 (c) 1996 - 2009 by Steve Baker, Thomas Moore, Francesc Rocher, Kyosuke Tokoro
$ seq 10 | xargs mkdir
$ tree
.
|-- 1
|-- 10
|-- 2
|-- 3
|-- 4
|-- 5
|-- 6
|-- 7
|-- 8
`-- 9