Ssh into large no of hosts

I’m trying to set up a workflow in n8n where I can SSH into multiple servers and run the same command on each of them.
I already have a workflow, but it isn’t working as expected. What I want to achieve is something like this:
I have a list of IP addresses (servers).
For each server, I want to connect via SSH.
Run the same command on all servers.

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Problem in node ‘Execute a command‘
getaddrinfo ENOTFOUND 34.30.194.197

Information on your n8n setup

  • **n8n version:**1.104.2
  • Database (default: SQLite):default
  • n8n EXECUTIONS_PROCESS setting (default: own, main):default
  • Running n8n via (Docker, npm, n8n cloud, desktop app):docker
  • Operating system: ubuntu

Hey @Imesh_Silva hope all is well.

Could you try this and see if that works for you?

i have large number of hosts around 80-100 and i used ‘34.30.194.197’, ‘144.126.219.55’ just for testing all i need is when i puut all the hostnames in a code node like given my workflow need to ssh into those host and run the same commands in all of the host . same ssh credential is configured for all of the hosts

Is there a question there? :slight_smile:

yes that one can only ssh to one host i have multiple hosts so without using multiple ssh node iam looking for a way if iam using the one you gave the workflow will be very large for 80-100 hosts

Ah I see, how about this then?

Change the hosts back to yours

Does the Host in the SSH crediential {{ $node[“Code”].json[“ip”].toString().trim() }} work for others in SSH’ing into the various servers? Mine SSH’ed into the server, ran a command, then loop, but still SSH’ed into the first server to run the command for the second time, even though the loop has moved onto the second IP. Not sure what’s off here.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.