Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # SSHkit
- # commands with sudo
- ## Passwordless
- * if you don't want to enter password each time
- * edit visudo
- ```
- myuser ALL=(ALL) NOPASSWD: ALL
- ```
- * execute command
- ```
- all_servers = ['myserver.com']
- myuser = 'myuser'
- pwd = 'mypwd'
- on all_servers do |srv|
- as(user: myuser) do
- execute('sudo apt-get -y update', interaction_handler: {
- "password: " => "#{pwd}\n",
- })
- end
- end
- end
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement