Sha256: de87deb75125d70189f12e744df4c507d28250ec0d6e93d2022f086e1fc3ec37

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

#!/usr/bin/ruby
require 'rubygems'
require 'trollop'
require 'rest_connection'
require 'net/ssh'

opts = Trollop::options do
  opt :deployment, "deployment nickname", :type => :string, :required => true
  opt :only, "regex string matching the nickname of the servers you want to relaunch. This excludes servers that do not match\nExample --only ubuntu", :type => :string, :required => false
  opt :growl, "use growl notification (string) when servers are all operational, requires ruby-growl gem", :type => :string, :required => false
end

# find all servers in the deployment (the fast way)
deployment = Deployment.find_by_nickname_speed(opts[:deployment]).first
servers = deployment.servers_no_reload
servers = servers.select { |s| s.nickname =~ /#{opts[:only]}/ } if opts[:only]

servers.each do |s|
  s.wait_for_operational_with_dns
  
  Net::SSH.start(s.dns_name, 'root', :keys => ['~/.ssh/publish-test']) do |ssh|
    puts "setting up devmode: dropbox::install && devmode::setup_cookbooks"
    puts ssh.exec!("rs_run_recipe -n 'dropbox::install'")
    puts ssh.exec!("rs_run_recipe -n 'devmode::setup_cookbooks'")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rest_connection-0.0.7 examples/dev_setup.rb
rest_connection-0.0.6 examples/dev_setup.rb
rest_connection-0.0.5 examples/dev_setup.rb
rest_connection-0.0.4 examples/dev_setup.rb
rest_connection-0.0.3 examples/dev_setup.rb
rest_connection-0.0.2 examples/dev_setup.rb
rest_connection-0.0.1 examples/dev_setup.rb