Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. from fabfile import task, env, run, execute, settings
  2.  
  3. @task
  4. def my_command():
  5. host, arg = env.host_string.split('_')
  6. with settings(host_string=host):
  7. run("python do_command.py {}".format(arg))
  8.  
  9. @task
  10. def do_commands():
  11. hosts = ['10.0.0.2', '10.0.0.3', '10.0.0.4', '10.0.0.5']
  12. command_args = []
  13. for host in hosts:
  14. for arg in range(9):
  15. command_hosts.append("{}_{}".format(host, arg))
  16. with settings(parallel=True):
  17. execute(my_command, hosts=command_hosts)
  18. ****
  19. fab do_commands
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement