Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (36 sloc) 1.01 KB
require 'capistrano_winrm'
# The ssl port will either be 443 for older WinRM implementations or 5986 for new versions.
role :win_domain, 'myhost:5985'
role :win_standalone, 'myhost-allalone:5985'
def winrm_netstat
host_data = {}
cmd = 'netstat -an'
winrm cmd do |channel, stream, data|
host_data[channel[:host]] = "" unless host_data[channel[:host]].is_a?(String)
host_data[channel[:host]] << data
end
host_data.each_pair do |host,data|
puts "HOST: #{host}"
puts "---------------------------------------"
puts data
puts "---------------------------------------"
end
end
task :winrm_krb5, :roles => :win_domain do
set :winrm_krb5_realm, 'EXAMPLE.COM'
winrm_netstat
unset :winrm_krb5_realm
end
task :winrm_plain, :roles => :win_standalone do
set :winrm_user, 'myuser'
set :winrm_password, 'mypass'
#set :winrm_ssl_ca_store, '/etc/ssl/certs'
winrm_netstat
#unset :winrm_ssl_ca_store
unset :winrm_user
unset :winrm_password
end
task :allwinrm do
winrm_krb5
winrm_plain
end