I have a database containing ip addresses and credentials
I can fetch the rows and execute a for-each loop
Inside the loop, I want to use ssh-client or similar to connect to the IP address using credentials, execute a command then close the connection
How am I able to connect using variables , and not have to hardcode details?
[Edit] Are you using node-red-contrib-ssh-client (node) - Node-RED? Looking at its github repository it hasn't been updated in three years, has no readme, and has unaddressed open issues, so I would advise against using that one.
Personally I would use an Exec node for this and execute ssh using that.
I’m writing the flow without knowing anything about the Linux endpoints that I want to use at runtime. I don’t know ip address username and password. I’d know, however, that I’ll be connecting using ssh protocol
At runtime, I will get the IP address, username and password from a database table
I’ll loop through the result set
For each iteration, I wish to execute some command (that does not matter for the sake of this question) on the Linux system loop.ipaddress, authenticated by loop.username and loop.password... and then close the connection
How do I get these loop variables into ssh-client or exec?
Don't know about ssh-client. For use in an exec node you just have to build the appropriate command and pass it to the exec node. So first work out what the command line you want to execute is, then you just have to build a string containing that.
Am I able to see each line as it comes back from the exec command? The description of exec spawn says I can, but I can’t get it working. Please post an example… if there is one. Does spawn actually work? So far, I’ve seen that is does not
“Confirm?” is one of any number of different “expect” messages coming back from from the server, each requiring a different response. I want to set up responses. I’m automating a current manual interactive process
In that case this is nothing to do with the subject line of the thread. I suggest you start a new thread and someone who knows how to do that will probably help. When you do that please post a flow that you think should work but does not.
A final thought here, if the s/w is asking for input specifically on the keyboard rather than via stdin/stdout/stderror than I don't think it can be done, though I may be wrong. Nothing to do with node-red, you would have the same issue using any s/w.
@TotallyInformation I like the look of ssh2shell! Thank you for posting. How do I call that from Node-RED ... I do not see it "manage pallet" I've tried creating a function to call it, but no luck probably because I'm new to Node-RED