Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
updated example
Browse files Browse the repository at this point in the history
  • Loading branch information
zenchild committed Mar 3, 2011
1 parent aee02a5 commit caa2a66
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions examples/capfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
require 'capistrano_winrm'

# The ssl port will either be 443 for older WinRM implementations or 5986 for new versions.
role :winrm, 'myhost:5986'
set :winrm_user, 'user'
set :winrm_password, 'pass'
set :winrm_ssl_ca_store, '/etc/ssl/certs'
role :win_domain, 'myhost:5985'
role :win_standalone, 'myhost-allalone:5985'

desc 'use "winrm" to run a test task'
task :testwinrm, :roles => :winrm do
def winrm_netstat
host_data = {}
cmd = 'ipconfig'
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
Expand All @@ -22,3 +19,24 @@ task :testwinrm, :roles => :winrm do
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

0 comments on commit caa2a66

Please sign in to comment.