- Do not require the user to patch Capistrano.
- Make the usage of WinRM in the Capfile as seamless as possible.
To accomplish what I wanted I had to override some methods within Capistrano to inject WinRM functionality. The end result adds a winrm command that should work almost identical to Capistrano's own run command. It should also allow your current Capfile to run unmodified if you do not have any winrm tasks.
To define a WinRM task you can simply do this:
winrm also supports using blocks just like run so you can format your output a bit better like so:
There you have it. As long is WinRM is configured on the remote Windows systems you can now manage them with your Capistrano infrastructure. There is a gem up on Rubygems that adds in the functionality so just do a:
gem install -r capistrano_winrm
The source code for this extension is also up on Github: