Dynamically set env.hosts in fabric

Create the following function object in 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():
    #processing

At the time of calling

call


% #Localhost only
% fab local deploy
%
% #Multiple hosts
% fab all deploy

Recommended Posts

Dynamically set env.hosts in fabric
Set spinning_friction in pybullet
Set ulimit in supervisor
Define a task to set the fabric env in YAML
Dynamically import scripts in Python
Methods available in set type
Run background job in fabric
Dynamically call methods in Python
Set up Nunjucks in Node.js
Set python test in jenkins
Set placeholders in input fields in Django
Use fabric as is in python (fabric3)
Dynamically add form fields in Django
Set opset to embed in ONNX
Dynamically load json type in python
Dynamically define functions (methods) in Python