the code below can set the dynamic hosts:
def set_hosts():
env.hosts = ['host1', 'host2']
def mytask():
run('ls /var/www')
but I only can run this in shell,and the job will work sequential not in parallel:
fab set_hosts mytask
how to run it in fabfile? so that I can set a decorator @parallel to the job to run parallel.
def set_namehost():
env.hosts = ['namehost']
def get_namehost():
run('ls /var/www')
def set_hosts():
env.hosts = ['host1', 'host2']
def mytask():
run('ls /var/www')
I only could run: fab set_namehost get_namehost ; fab set_hosts mytask in shell,input twice. how to define the two jobs into one?