Class: Subspace::Commands::Ssh

Inherits:
Base
  • Object
show all
Defined in:
lib/subspace/commands/ssh.rb

Instance Method Summary collapse

Methods inherited from Base

#copy, #dest_dir, #gem_path, #require_configuration, #template, #template_dir

Methods included from Ansible

#ansible_command

Constructor Details

#initialize(args, options) ⇒ Ssh

Returns a new instance of Ssh.



3
4
5
6
# File 'lib/subspace/commands/ssh.rb', line 3

def initialize(args, options)
  @host = args.first
  run
end

Instance Method Details

#runObject



8
9
10
11
12
13
# File 'lib/subspace/commands/ssh.rb', line 8

def run
  host_vars = YAML.load_file("config/provision/host_vars/#{@host}")
  cmd = "ssh #{host_vars["ansible_ssh_user"]}@#{host_vars["ansible_ssh_host"]}"
  say cmd
  exec cmd
end