Integrating Rundeck with Windows WinRM

2,654 views
Skip to first unread message

Ramakanta Sahoo

unread,
May 27, 2015, 11:00:11 AM5/27/15
to rundeck...@googlegroups.com
Hi Team,

I am trying to integrate the rundeck with a windows system to use in one of the project.

Below are the steps which I had followed to add a windows node.
1. On the windows box configured WinRM service and its listening on HTTP

PS C:\Windows\system32> winrm enumerate winrm/config/listener
Listener
    Address = *
    Transport = HTTP
    Port = 5985
    Hostname
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint
    ListeningOn = 127.0.0.1, 169.X.X.19, 172.X.X.31, 172.X.X.16, 192.168.X.X, ::1

2. Downloaded the WinRM plugin and added to Rundeck Linux box.
3. Updated resource.xml with the new windows node name:

  <node name="windowsnode1" description="Rundeck server node Windows" tags="" hostname="mymachine.mydomain.com" osArch="x86_64" osFamily="windows" osName="Microsoft Windows 7 Professional" osVersion="6.1.7601 Service Pack 1 Build 7601" username="someadminaccountname"/>

4. Tried to run a sample command on the node using the rundeck UI and it never finishes and I have to kill it to stop the progress.

I am not sure If I am doing it correctly as it seems I am not sure hows the authentication happens to windows box via winrm, for UNIX boxes I use ssh keys which works perfectly fine.
I use the latest rundeck available i.e. 2.4

Please help me on how do I setup the windows node!!

Thanks




Ramakanta Sahoo

unread,
May 28, 2015, 1:56:38 PM5/28/15
to rundeck...@googlegroups.com
Now I am able to run commands directly using the Winrmpassword option in a job but if I try to run a small batch script it throws below error:

[workflow] finishExecuteNodeStep(windows-host): NodeDispatch: AuthenticationFailure: [jsch-scp] Failed copying the file: Authentication failure connecting to node: "windows-host". Password incorrect.
08:33:07 Failed dispatching to node windows-host: [jsch-scp] Failed copying the file: Authentication failure connecting to node: "windows-host". Password incorrect.
08:33:07 Failed dispatching to node windows-host: com.dtolabs.rundeck.core.execution.workflow.steps.node.NodeStepException: [jsch-scp] Failed copying the file: Authentication failure connecting to node: "windows-host". Password incorrect. at com.dtolabs.rundeck.core.execution.workflow.steps.node.impl.ScriptFileNodeStepExecutor.executeScriptFile(ScriptFileNodeStepExecutor.java:138)
at com.dtolabs.rundeck.core.execution.workflow.steps.node.impl.ScriptFileNodeStepExecutor.executeNodeStep(ScriptFileNodeStepExecutor.java:67)

It seems trying to connect using the scp protocol, so not sure do I need to have a sshd server also running apart from winrm to copy files? to windows host? is there no way to do it through winrm itself?

Ramakanta Sahoo

unread,
May 30, 2015, 2:21:46 PM5/30/15
to rundeck...@googlegroups.com
Hi Team,

Any help much appreciated!! 

How do I configure the rundeck 2.4.2 to copy my inline script to remote windows host and execute the same.

Ramakanta Sahoo

unread,
May 31, 2015, 4:32:55 PM5/31/15
to rundeck...@googlegroups.com
Any one??
 Please do let me know what I might be missing here... if I run a remote command only it works but if I put the same command in inline script it fails and seems its trying to connect to SSH of windows machine whereas I have only winrm service running no SSH.

Please help... online documentation of overthere plugin does not help much...

Mathieu Chateau

unread,
Jun 1, 2015, 1:43:17 AM6/1/15
to rundeck...@googlegroups.com
Hello,

I think inline script are copied over ssh as a temp file, and so through ssh.

Just guessing as I see them as temp file on linux

Cordialement,
Mathieu CHATEAU
http://www.lotp.fr

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/bff66464-8db2-4377-9faf-01a468fc7abd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dzz...@gmail.com

unread,
Jun 3, 2015, 11:35:00 PM6/3/15
to rundeck...@googlegroups.com
Hello,
We had similar situation and fixed it by adding a OTWinRMFileCopier.java which does a sftp of the file over to the windows server and executes remotely. Works great.
Brief steps:
(I will write a more details docs around setting this up and send that over later tomorrow).

0. Setup FTP on the Linux Rundeck server ( vsftpd with some additional configuration http://www.firewall.cx/linux-knowledgebase-tutorials/system-and-network-services/875-linux-vsftpd-setup-configure.html)
( had to create a ftp user rdftp and password and externalized it in framework.properties. Also make sure that ftp user can access the .tmp files from under RDECK_BASE/var/tmp )
# Username/password used for FTP
framework.rdftp.username = rdftp
framework.rdftp.password = **REDACTED**

1. Added the OTWinRMFileCopier.java to the plugin ( Attached )
2. Added the sftp cmd ( like below)

341     protected CmdLine buildFtpScript(String command, String destinationPath , String ftpServer, String ftpUsername, String ftpPassword) {
342         return buildCmdLineRaw(("cmd /c echo open " + ftpServer + ">ftpscript&&"
343                 + "echo " + ftpUsername + ">>ftpscript&&"
344                 + "echo " + ftpPassword + ">>ftpscript&&"
345                 + "echo binary>>ftpscript&&"
346                 + "echo cd tmp>>ftpscript&&"
347                 + "echo get " + command + " " + destinationPath + ">>ftpscript&&"
348                 + "echo quit>>ftpscript&&"
349                 + "sftp -s:ftpscript&&del ftpscript").split(" "));
350     }

3. Compile and configure the SCP option in the Project configuration
4. Inline scripts work.

Cheers, Dharmendra
OTWinRMFileCopier.java

Ramakanta Sahoo

unread,
Jun 17, 2015, 4:32:37 AM6/17/15
to rundeck...@googlegroups.com
Hi Dharmendra,

Thanks a lot for the info. Can you please give me step by step configurations to do.

Like the project configuration project.properties changes and resources.xml and framework.properties for sample single windows node including the plugin version I shall use.

thanks again

Ramakanta

Diego Fernando Luisi

unread,
Jun 17, 2015, 1:42:14 PM6/17/15
to rundeck...@googlegroups.com
I hope to help you , I wrote this article showing how to configure the Rundeck with WinRM .

Any doubt please comment on the blog.

Ramakanta Sahoo

unread,
Jun 17, 2015, 2:14:26 PM6/17/15
to rundeck...@googlegroups.com
Hi Diego,

Thanks for the article but it is at current not much of help as the issue I am referring is about running inline scripts using winrm plugin which is currently does not work only commands work.

Do you have any steps for the same then please do let me know.

Thanks,
Ramakanta
Reply all
Reply to author
Forward
0 new messages