Last active
August 29, 2015 14:01
-
-
Save jgrunzweig/d37ea9033eb05dd76fa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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