LoginSignup
8
5

More than 5 years have passed since last update.

fabricでenv.hostsを動的に設定する

Posted at

fabfile.py内で以下のような関数オブジェクトを作る

fabfile.py
env.hosts = ['127.0.0.1']

def local():
    env.hosts = ['127.0.0.1']

def all():
    env.hosts = ['aaa.example.com','bbb.example.com',...]

def deploy():
    # 処理

呼び出し時

呼び出し
% # ローカルホストのみ
% fab local deploy
%
% # 複数ホスト
% fab all deploy
8
5
2

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