Can LInux and WIndows node exist in same project ?

395 views
Skip to first unread message

Aman Sharma

unread,
Jan 27, 2022, 5:55:17 PM1/27/22
to rundeck-discuss
Rundeck version - 3.1 Community edition. Rundeck is running on Linux host.

Can LInux and WIndows node exist in same project ?

rac...@rundeck.com

unread,
Jan 28, 2022, 7:16:59 AM1/28/22
to rundeck-discuss

Sure,

Defining the node-executor and file-copier attributes on your nodes (assuming that you’re using a resources.xml/yml node definition) you can obtain a multiple-os node definition in the same project.

For example, for windows nodes: node-executor="WinRMPython" file-copier="WinRMPython", and for linux nodes: node-executor="jsch-ssh" file-copier="jsch-scp".

Take a look at this thread and here is another example using an ansible integration.

Greetings.

Aman Sharma

unread,
Jan 28, 2022, 10:23:05 AM1/28/22
to rundeck-discuss
While Doing this. I don't have to change anything in project settings ?
I just have to add two additional parameters node-executor="" file-copier=""in resources.yaml for the this poject and I can use the windows and LINUX nodes in same project? Does it mean when I do these modifications in File project settings page will give me an option to update the login details like user/password & ssh settings ?

rac...@rundeck.com

unread,
Jan 28, 2022, 10:27:38 AM1/28/22
to rundeck-discuss
Yes, you don't need to do anything in the default project section, these params override the default configuration.

That's the way to use mixed nodes on Rundeck.

Greetings.

Aman Sharma

unread,
Jan 31, 2022, 4:04:48 PM1/31/22
to rundeck-discuss
When I make necessary change in resource.yaml file.. I can see node in my portal..but when I test the command from command option I get following error.

ERROR ] Execution finished with the following error (winrm-exec.py:323)[root]
[ERROR ] the specified credentials were rejected by the server (winrm-exec.py:324)[root]
Failed: NonZeroResultCode: [WinRMPython] Result code: 1
Execution failed: 199 in project Test2: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [node5: NonZeroResultCode: [WinRMPython] Result code: 1 + {dataContext=MultiDataContextImpl(map={ContextView(step:1, node:node5)=BaseDataContext{{exec={exitCode=1}}}, ContextView(node:node5)=BaseDataContext{{exec={exitCode=1}}}}, base=null)} ]}, Node failures: {node5=[NonZeroResultCode: [WinRMPython] Result code: 1 + {dataContext=MultiDataContextImpl(map={ContextView(step:1, node:node5)=BaseDataContext{{exec={exitCode=1}}}, ContextView(node:node5)=BaseDataContext{{exec={exitCode=1}}}}, base=null)} ]}, status: failed]


rsources.yaml :

node5:
  hostname: "IP ADDRESS of the node"
  tags: "windows"
  node-executor: "WinRMPython"
  file-copier: "WinRMPython"
  username: "azureuser"
  winrm-password-storage-path: "keys/keys/node/password"
  winrm-authtype: "basic"

rac...@rundeck.com

unread,
Jan 31, 2022, 4:25:09 PM1/31/22
to rundeck-discuss

Hi,

That’s an authentication error: the specified credentials were rejected by the server make sure to configure the target node following these steps. You can test that using a basic WinRM python script like the following example:

import winrm

session = winrm.Session('xx.xx.xx.xx', auth=('your_windows_username','windows_password'))
result = session.run_ps("hostname")
print(result.std_out)

Greetings.

Aman Sharma

unread,
Jan 31, 2022, 4:36:06 PM1/31/22
to rundeck-discuss
AM I missing something in winrm config ?

Config
    MaxEnvelopeSizekb = 500
    MaxTimeoutms = 60000
    MaxBatchItems = 32000
    MaxProviderRequests = 4294967295
    Client
        NetworkDelayms = 5000
        URLPrefix = wsman
        AllowUnencrypted = false
        Auth
            Basic = true
            Digest = true
            Kerberos = true
            Negotiate = true
            Certificate = true
            CredSSP = false
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        TrustedHosts
    Service
        RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GAGXGWGR;;;LA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
        MaxConcurrentOperations = 4294967295
        MaxConcurrentOperationsPerUser = 1500
        EnumerationTimeoutms = 240000
        MaxConnections = 300
        MaxPacketRetrievalTimeSeconds = 120
        AllowUnencrypted = false
        Auth
            Basic = true
            Kerberos = false
            Negotiate = true
            Certificate = false
            CredSSP = false
            CbtHardeningLevel = Relaxed
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        IPv4Filter = *
        IPv6Filter = *
        EnableCompatibilityHttpListener = false
        EnableCompatibilityHttpsListener = false
        CertificateThumbprint
        AllowRemoteAccess = true
    Winrs
        AllowRemoteShellAccess = true
        IdleTimeout = 7200000
        MaxConcurrentUsers = 10
        MaxShellRunTime = 2147483647
        MaxProcessesPerShell = 25
        MaxMemoryPerShellMB = 1024
        MaxShellsPerUser = 30

Aman Sharma

unread,
Jan 31, 2022, 4:42:20 PM1/31/22
to rundeck-discuss
output of the script.

python test.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/winrm/transport.py", line 340, in _send_message_request
    response.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error:  for url: http://10.0.0.14:5985/wsman

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 4, in <module>

    result = session.run_ps("hostname")
  File "/usr/local/lib/python3.8/dist-packages/winrm/__init__.py", line 52, in run_ps
    rs = self.run_cmd('powershell -encodedcommand {0}'.format(encoded_ps))
  File "/usr/local/lib/python3.8/dist-packages/winrm/__init__.py", line 39, in run_cmd
    shell_id = self.protocol.open_shell()
  File "/usr/local/lib/python3.8/dist-packages/winrm/protocol.py", line 166, in open_shell
    res = self.send_message(xmltodict.unparse(req))
  File "/usr/local/lib/python3.8/dist-packages/winrm/protocol.py", line 243, in send_message
    resp = self.transport.send_message(message)
  File "/usr/local/lib/python3.8/dist-packages/winrm/transport.py", line 334, in send_message
    response = self._send_message_request(prepared_request, message)
  File "/usr/local/lib/python3.8/dist-packages/winrm/transport.py", line 344, in _send_message_request
    raise InvalidCredentialsError("the specified credentials were rejected by the server")
winrm.exceptions.InvalidCredentialsError: the specified credentials were rejected by the server

rac...@rundeck.com

unread,
Feb 1, 2022, 7:13:34 AM2/1/22
to rundeck-discuss
Hi,

The script is returning the same error from your windows machine, take a look at this. Also, make sure to configure the server/client Auth on the windows side.

Regards.

Aman Sharma

unread,
Feb 1, 2022, 5:03:29 PM2/1/22
to rundeck-discuss
Is it necessory that this user (which we use to authenticate) must have domain admin privileges ?
in my case, I gave it full rights.. still receiving same issue.

Aman Sharma

unread,
Feb 1, 2022, 5:06:02 PM2/1/22
to rundeck-discuss
my user is in builtindadmin group.

Aman Sharma

unread,
Feb 1, 2022, 5:51:16 PM2/1/22
to rundeck-discuss
Hey Thank you so much for your help and guidance, it worked. 

My sample resource.yaml file looks like following:

root@rundeckVM1:/home/azureaman/test2-project# cat resources.yaml
node4:
  nodename: rundeck3
  hostname: IP-address
  description: 'azurevm-rundeck3'
  tags: "agent, node4, rundeck3"
  username: azureuser
  osFamily: Linux rundeck
node5:
  hostname: "IP-address"

  tags: "windows"
  node-executor: "WinRMPython"
  file-copier: "WinRMPython"
  username: "user35"
  winrm-authtype: "basic"
  winrm-port: "5985"
  winrm-shell: "powershell"
  winrm-password-storage-path: "keys/home/keypath"

1) Then I had to define my user & password at keys/home/keypath using "Key Storage" option from settings.
2) on remote node I have to run following commands to setup the winrm.
winrm get winrm/config
winrm set winrm/config/service/Auth '@{Basic="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'
winrm set winrm/config/service/Auth '@{Kerberos="false"}'
winrm enumerate winrm/config/listener
winrm configSDDL default -->>> then give full permission or read/execute permission to my user "user35"

3) then reboot the server to enable these configurations.
4) then I tested the configuration from command option & following script.

import winrm session = winrm.Session('xx.xx.xx.xx', auth=('your_windows_username','windows_password')) result = session.run_ps("hostname") print(result.std_out) 

followed your suggestion and following links


--->> initially python command was not running on rundeck  as my Rundeck server has python3 which is required for this winrm plugin.
I overcame that problem by linking following in /usr/bin  by using ln command.

python -> python3.8
python-config -> python3.8-config
x86_64-linux-gnu-python3-config -> x86_64-linux-gnu-python3.8-config
Reply all
Reply to author
Forward
0 new messages