LoginSignup
5
7

More than 5 years have passed since last update.

Capistranoでroleが空の場合でも処理を続行させる方法

Last updated at Posted at 2014-06-25

問題

Capistrano は role が空の場合、以下の様なエラーが表示され処理が停止してしまう。

`deploy:your_task' is only run for servers matching {:roles=>[:role]}, but no servers matched

しかし、本番環境にはあるが開発環境には存在しないサーバも存在するので role を空にしたい場合がある。

解決方法

:on_no_matching_servers パラメータに空の場合の処理を追加することができる。

namespace :deploy
  task :change_pathes, :roles => :special_roles, :on_no_matching_servers => :continue do
    # 処理
  end
end
after "deploy:update", "deploy:change_paths"

以下の様にスキップされる

** skipping `deploy:change_pathes' because no servers matched

参考

5
7
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
7