Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from fabfile import task, env, run, execute, settings
- @task
- def my_command():
- host, arg = env.host_string.split('_')
- with settings(host_string=host):
- run("python do_command.py {}".format(arg))
- @task
- def do_commands():
- hosts = ['10.0.0.2', '10.0.0.3', '10.0.0.4', '10.0.0.5']
- command_args = []
- for host in hosts:
- for arg in range(9):
- command_hosts.append("{}_{}".format(host, arg))
- with settings(parallel=True):
- execute(my_command, hosts=command_hosts)
- ****
- fab do_commands
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement