I am trying to use net-ssh-multi to run a command on a group of servers. For this taks, ssh-key authentication is not an option; a password has to be passed to each server defined in the session.use lines. Here's the problem, 'net/ssh' can take a password parameter, but 'net/ssh/multi' cannot. What I would like to do is somehting like this:
require 'net/ssh'
require 'net/ssh/multi'
#The necessary data is contained in a Ticket object
my_ticket = Ticket.new
Net::SSH::Multi.start (:password => 'xxxx') do |session|
# define the servers we want to use
my_ticket.servers.each do |serv_id|
session.use "#{my_ticket.user_name}@#{serv_id}"
end
# execute commands on all servers
session.exec "uptime"
# run the aggregated event loop
session.loop
end
However, this get me:
file.rb:35:in `start': wrong number of arguments (1 for 2) (ArgumentError) from file.rb:35
I know this is a bit of a n00b question, but I would really appreciate some help.
(http://rubydoc.info/gems/net-ssh-multi/1.1/Net/SSH/Multi)