furnish-ssh

Inject SSH remote commands into your provisioning pipeline. See furnish for information on what furnish is.

Installation

Add this line to your application's Gemfile:

gem 'furnish-ssh'

And then execute:

$ bundle

Or install it yourself as:

$ gem install furnish-ssh

Usage

SSH requires ip addresses, which implies machines and possibly something like furnish-ip to manage a pool of them. This example will use AutoIP and Vagrant from furnish-vagrant.

It doesn't have to be this complicated (and won't be in most cases), this is just a complete example.

require 'furnish'
require 'furnish/ip'
require 'furnish/provisioners/ip'
require 'furnish/provisioners/vagrant'
require 'furnish/provisioners/ssh'

Furnish.init
sched = Furnish::Scheduler.new
# Furnish::IP is a database of allocated addresses and more will be allocated
# by the AutoIP provisioner.
ip    = Furnish::IP.new('10.10.10.0/24')
# allocate gateway and network IPs so Vagrant can NAT properly
[0, 1].each { |x| ip.allocate("10.10.10.#{x}") }

# create our group - get an ip, hand it to vagrant which creates a machine,
# hand it to ssh which updates the box.
group = Furnish::ProvisionerGroup.new(
  'test',
  [
    Furnish::Provisioner::AutoIP.new(:ip => ip, :number_of_addresses => 1),
    Furnish::Provisioner::Vagrant.new(:box => "precise64", :number_of_machines => 1),
    Furnish::Provisioner::SSH.new(
      :username => "vagrant",
      :password => "vagrant",
      :startup_command => "sudo apt-get update; sudo apt-get dist-upgrade -y"
    )
  ]
)

sched << group
sched.run

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request