Module: Ec2Ssh::Cli::Ssh

Defined in:
lib/ec2-ssh/ssh.rb

Instance Method Summary collapse

Instance Method Details

#set_ssh(user) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ec2-ssh/ssh.rb', line 6

def set_ssh(user)
  ENV['SSHKIT_COLOR'] = 'TRUE'
  SSHKit.config.output_verbosity = Logger::DEBUG
  SSHKit::Backend::Netssh.configure { |ssh|
    ssh.ssh_options = {
      :user => user,
      :paranoid => false,
      :forward_agent => true,
      :user_known_hosts_file => '/dev/null'
    }
  }
end

#ssh_to(user, dsl_options, cmd) ⇒ Object



19
20
21
22
# File 'lib/ec2-ssh/ssh.rb', line 19

def ssh_to(user, dsl_options, cmd)
  say "Running #{cmd} via ssh in #{dsl_options}", color = :cyan
  on(@all_servers, in: dsl_options[:in]) { |host| execute cmd }
end