5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pry使ってknifeを流す

Last updated at Posted at 2014-10-16

rubyやってる人には当然のことでしょうけど自分は知らなかったのでメモ

10台ぐらいまでなら手動でもいいのかもしれないけど増えてくると大変だろうからpryを使って一気に流す

# pry
> nodes = (1..4).map {|n| "hostname-role-#{n}"}
> nodes.reject do |node|
>   system "knife solo prepare #{node}"
> end
> nodes.reject do |node|
>  system "knife solo cook #{node} --why-run"
> end
エラーになるホストがなければ下を実施
> nodes.each do |node|
>  system "knife solo cook #{node}"
> end
  • 配列はnodes=%w()で改行しながら入力でも可
> nodes = %w(
> hostname-role-1
> hostnmae-role-2
> )
  • rejectは戻り値がFalseだったものを表示する
  • eachはnodesの分だけ繰り返す
5
5
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
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?