Guest User

Untitled

a guest
Jul 15th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #Must be run with role foo, since foo has sudo access or other permissions
  2. @hosts(*env.roledefs['foo'])
  3. def do_foo_actions():
  4. sudo("mkdir /usr/local/program")
  5. sudo("chown -R bar:bar /usr/local/program")
  6.  
  7. #Most of the work here is done in role bar. But the folder /usr/local/program must exist before we can deploy
  8. @hosts(*env.roledefs['bar'])
  9. def deploy_program():
  10. for h in env.roledefs['foo']:
  11. with settings(host_string=h):
  12. do_foo_actions()
  13. #From here on out, commands will be run as hadoop rather than hadoopadmin
  14. put(..., "/usr/local/program")
Add Comment
Please, Sign In to add comment