rundeck-plugins / py-winrm-plugin

15 stars 21 forks source link

Job execution fails with version 2.0.6 #50

Closed mirkoknoll closed 3 years ago

mirkoknoll commented 4 years ago

Hi, we have configured one Windows host in Rundeck project with ssh default node executor via resource.xml

<node name="myhost" node-executor="WinRMPython" hostname="myhost" winrm-transport="https" osFamily="Windows" winrm-authtype="basic" winrm-nossl="true" winrm-port="5986" winrm-password-storage-path="mykeypath" username="myuser" />

and job execution was working with Rundeck 3.2.4 and py-winrm-plugin 2.0.5. On debug output I get this:

[WinRMPython] executing: [[/bin/sh, /opt/rundeck/libext/cache/py-winrm-plugin-2.0.5/wrapper.sh, winrm-exec.py, ${node.hostname}]]

The same config is also working with Rundeck 3.2.5 and 3.2.6 and py-winrm-plugin 2.0.5.

With Rundeck 3.2.5 or 3.2.6 and py-winrm-plugin 2.0.6 I get this: [WinRMPython] executing: [[${config.interpreter}, -u, /opt/rundeck/libext/cache/py-winrm-plugin-2.0.6/winrm-exec.py, ${node.hostname}]] and the job is failing with: [ERROR ] winrm not installed, try: pip install pywinrm (winrm-exec.py:187)[root]

Do I have to set config.interpreter somewhere in job or Rundeck config?

On Rundeck server itself (Debian) I can execute winrm-check.py successfully:

/opt/rundeck/libext/cache/py-winrm-plugin-2.0.6$ python winrm-check.py --username myuser --hostname myhost --password 'mypw' --port 5986 --transport https b'\r\nWindows IP Configuration\r\n\r\n\r\nEthernet adapter Prod:\r\n\r\n Connection-specific DNS Suffix . : mydomain\r\n IPv4 Address. . . . . . . . . . . : 10.11.12.13\r\n Subnet Mask . . . . . . . . . . . : 255.255.192.0\r\n Default Gateway . . . . . . . . . : 10.11.12.1\r\n' Connection with host myhost successfull

Cheers Mirko

master-qwerty commented 3 years ago

Hello, I have the same issue. And it's driving me crazy for a couple of hours already. Is there anyone who solved it? [ERROR ] winrm not installed, try: pip install pywinrm (winrm-exec.py:224)[root]

pywinrm is installed under python3 (pip3) root@rundeck:/$ pip3 list | grep pywinrm pywinrm 0.4.1

Project is configured : Default Node Executor > Python Interpreter = python3 A job with workflow 'WinRM Check Step' has passed successfully.

WinRM configuration on Nodes & Project Default Node Executor: winrm-authtype="credssp" winrm-transport="https" winrm-shell="powershell" winrm-port="5986"

Versions:

sambuysse commented 3 years ago

Having the same problem as @master-qwerty.

winrm-check from local Rundeck server to remote Windows node succeeds but Job execution to that remote node fails with [ERROR ] winrm not installed, try: pip install pywinrm (winrm-exec.py:224)[root].

sambuysse commented 3 years ago

I have just solved my version of this problem. As specified in the plugin docs I installed the winrm module using pip with

$ pip install pywinrm

but the winrm-exec.py script was unable to find the module. (while winrm-check.py does work...)

As I am using an Ubuntu server, I eventually tried to install it with

$ sudo apt install python3-winrm

which solved the problem immediately.

TL;DR Try to install the winrm module through your distribution's package manager and that might solve your problem.

Cheers.

mirkoknoll commented 3 years ago

@Samaruq: Works for me, thanks for the hint!