class Sprinkle::Actors::SSH

The SSH actor requires no additional deployment tools other than the Ruby SSH libraries.

deployment do
  delivery :ssh do
    user "rails"
    password "leetz"
    port 2222

    role :app, "app.myserver.com"
  end
end

Use ssh key file

deployment do
  delivery :ssh do
    user "sprinkle"
    keys "/path/to/ssh/key/file" # passed directly to Net::SSH as :keys option

    role :app, "app.myserver.com"
  end
end

Working thru a gateway

If you're behind a firewall and need to use a SSH gateway that's fine.

deployment do
  delivery :ssh do
    gateway "work.sshgateway.com"
  end
end

Public Instance Methods

gateway(gateway) click to toggle source

Set an optional SSH gateway server - if set all outbound SSH traffic will go thru this gateway

# File lib/sprinkle/actors/ssh.rb, line 80
def gateway(gateway)
  @options[:gateway] = gateway
end
keys(keys) click to toggle source
# File lib/sprinkle/actors/ssh.rb, line 99
def keys(keys)
  @options[:keys] = keys
end
password(password) click to toggle source

Set the SSH password

# File lib/sprinkle/actors/ssh.rb, line 90
def password(password)
  @options[:password] = password
end
port(port) click to toggle source

Set the SSH port

# File lib/sprinkle/actors/ssh.rb, line 95
def port(port)
  @options[:port] = port
end
role(role, server) click to toggle source

Define a role and add servers to it

role :app, "app.server.com"
role :db, "db.server.com"
# File lib/sprinkle/actors/ssh.rb, line 73
def role(role, server)
  @roles[role] ||= []
  @roles[role] << server
end
use_sudo(value=true) click to toggle source

Set this to true to prepend 'sudo' to every command.

# File lib/sprinkle/actors/ssh.rb, line 104
def use_sudo(value=true)
  @options[:use_sudo] = value
end
user(user) click to toggle source

Set the SSH user

# File lib/sprinkle/actors/ssh.rb, line 85
def user(user)
  @options[:user] = user
end

Private Instance Methods

blue(text) click to toggle source
# File lib/sprinkle/actors/ssh.rb, line 265
def blue(text)
  color(34, text)
end
color(code, text) click to toggle source
# File lib/sprinkle/actors/ssh.rb, line 253
def color(code, text)
  "\033[%sm%s\033[0m"%[code,text]
end
green(text) click to toggle source
# File lib/sprinkle/actors/ssh.rb, line 262
def green(text)
  color(32, text)
end
red(text) click to toggle source
# File lib/sprinkle/actors/ssh.rb, line 256
def red(text)
  color(31, text)
end
yellow(text) click to toggle source
# File lib/sprinkle/actors/ssh.rb, line 259
def yellow(text)
  color(33, text)
end