Skip to content

Instantly share code, notes, and snippets.

@jgrunzweig
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgrunzweig/d37ea9033eb05dd76fa6 to your computer and use it in GitHub Desktop.
Save jgrunzweig/d37ea9033eb05dd76fa6 to your computer and use it in GitHub Desktop.
require 'sinatra'
require 'net/scp'
get '/provision' do
file = 'CONFIGS!....txt'
f = File.new(file, 'w')
f.write(params[:ip])
f.write('other stuff')
f.close
Net::SCP.upload!("remote.host.com", "username", file, "/remote/path", :ssh => { :password => "password" })
File.delete(file)
end
#################
#
# CHI-SP-P9FD57:Desktop jgrunzweig$ ruby matt.rb
# [2014-05-16 11:36:21] INFO WEBrick 1.3.1
# [2014-05-16 11:36:21] INFO ruby 2.1.0 (2013-12-25) [x86_64-darwin12.0]
# == Sinatra/1.4.5 has taken the stage on 4567 for development with backup from WEBrick
# [2014-05-16 11:36:21] INFO WEBrick::HTTPServer#start: pid=2206 port=4567
#
#################
#################
#
# wget http://127.0.0.1:4567/provision?ip=10.10.10.10
#
#################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment