Hi Ashish,
Thanks for your reply.
Here is what is happening:
1.We are trying to connect via rundeck user "user" to a linux box using a public-private key pair using below command from the Rundeck Linux machine:
ssh -i /var/lib/rundeck/.ssh/public_key user@<hostname> 'sudo echo test'
And we get below output:
This system is intended for authorised users only.
stdin: is not a tty
test
2. If I configure my this <hostname> in my resources.xml file like below:
<node name="MyHost" description="MyHost" tags="MyHost"
hostname="<hostname>"
ssh-keypath="/var/lib/rundeck/.ssh/id_rsa"
ssh-authentication="privateKey"
username="rundeck"
/>
and try to execute similar command(sudo echo test) from Rundeck->Commands
sudo echo test
I am getting below error(same as before):
[workflow] beginExecuteNodeStep(MyHost): NodeDispatch: com.dtolabs.rundeck.execution.ExecutionItemFactory$4@43fbbc67
Using ssh keyfile: /var/lib/rundeck/.ssh/public_key
Starting SSH Connection: rundcek@hostname (MyHost)
Set timeout to 0
Connecting to hostname:22
Remote command failed with exit status -1
Failed: NonZeroResultCode: Remote command failed with exit status -1
3.However when we checked the logs on the other linux box (on MyHost) it says:
"Accepted public key from <rundeckServer>"
"connection timed out by the client"
4.Also if I configure my node with node-exec and script-exec entries in resources.xml file, I am able to connect to this <MyHost>
<node name="MyHost" description="MyHost" tags="MyHost"
hostname="<hostname>"
ssh-keypath="/var/lib/rundeck/.ssh/id_rsa"
ssh-authentication="privateKey"
username="rundeck"
node-executor="script-exec"
script-exec="ssh -i /var/lib/rundeck/.ssh/id_rsa ${node.username}@${node.hostname} ${exec.command}"
script-exec-shell="bash -c"
/>
Now, if I go to Rundeck->Commands and execute
echo test or sudo echo test; I get below success:
[workflow] Begin step: 1,NodeDispatch
1: Workflow step executing: com.dtolabs.rundeck.execution.ExecutionItemFactory$4@3f972a2
preparing for sequential execution on 1 nodes
Executing command on node: MyHost, NodeEntryImpl{attributes={script-exec-shell=bash -c, hostname=<hostname>, ssh-authentication=privateKey, username=rundeck,nodename=MyHost, node-executor=script-exec, script-exec=ssh -i /var/lib/rundeck/.ssh/id_rsa ${node.username}@${node.hostname} ${exec.command}, ssh-keypath=/var/lib/rundeck/.ssh/id_rsa }, project='null'}
[workflow] beginExecuteNodeStep(MyHost): NodeDispatch: com.dtolabs.rundeck.execution.ExecutionItemFactory$4@3f972a2
[script-exec] executing: bash -c ssh -i /var/lib/rundeck/.ssh/id_rsa rundeck@<hostname> sudo echo test
**** WARNING ****
This system is intended for authorised users only.
stdin: is not a tty
test
[script-exec]: result code: 0, success: true
[workflow] finishExecuteNodeStep(MyHost): NodeDispatch: Succeeded
1: Workflow step finished, result: Dispatch successful (1 nodes)
[workflow] Finish step: 1,NodeDispatch
[workflow] Finish execution: rundeck-workflow-node-first: [Workflow , Node failures: MyHost=[]}]
5.I have selected the Debug Mode in Rundeck Job Config;Can you please tell me if there is way to increase SSH logging?
Thanks in advance.
Regards,
Versha