Created
December 24, 2014 08:12
-
-
Save akagisho/676d9c602fcad7fd7add 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 'serverspec' | |
require 'net/ssh' | |
set :backend, :ssh | |
if ENV['ASK_SUDO_PASSWORD'] | |
begin | |
require 'highline/import' | |
rescue LoadError | |
fail "highline is not available. Try installing it." | |
end | |
set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false } | |
else | |
set :sudo_password, ENV['SUDO_PASSWORD'] | |
end | |
host = ENV['TARGET_HOST'] | |
options = Net::SSH::Config.for(host) | |
options[:user] ||= Etc.getlogin | |
set :host, options[:host_name] || host | |
set :ssh_options, options | |
# Disable sudo | |
# set :disable_sudo, true | |
# Set environment variables | |
# set :env, :LANG => 'C', :LC_MESSAGES => 'C' | |
# Set PATH | |
# set :path, '/sbin:/usr/local/sbin:$PATH' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment