Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'serverspec'
- require 'highline/import'
- require 'net/ssh'
- require 'net/ssh/proxy/command'
- require 'pry'
- def ssh_user
- ENV['SSH_USER'] || ask("SSH user name for #{@bastion}: ")
- end
- def ssh_pass
- ENV['SSH_PASS'] || ask("SSH password: ") { |q| q.echo = "*" }
- end
- bastion = ENV['BASTION']
- target_host = ENV['TARGET_HOST']
- user = Net::SSH::Config.for(bastion)[:user] || ssh_user
- proxy = Net::SSH::Proxy::Command.new("ssh #{user}@#{bastion} nc %h %p")
- RSpec.configure do |config|
- set :host, target_host
- set :ssh_options, :user => user, :proxy => proxy, :forward_agent => true, :paranoid => false
- set :backend, :ssh
- set :disable_sudo, true
- set :request_pty, true
- config.color = true
- config.formatter = 'progress'
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement