Advertisement
Guest User

Untitled

a guest
Jul 5th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. # SSHkit
  2.  
  3. # commands with sudo
  4.  
  5. ## Passwordless
  6.  
  7. * if you don't want to enter password each time
  8.  
  9. * edit visudo
  10.  
  11. ```
  12. myuser ALL=(ALL) NOPASSWD: ALL
  13. ```
  14.  
  15. * execute command
  16.  
  17. ```
  18.  
  19. all_servers = ['myserver.com']
  20. myuser = 'myuser'
  21. pwd = 'mypwd'
  22.  
  23. on all_servers do |srv|
  24. as(user: myuser) do
  25. execute('sudo apt-get -y update', interaction_handler: {
  26. "password: " => "#{pwd}\n",
  27. })
  28. end
  29.  
  30. end
  31. end
  32. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement