Answer the question
In order to leave comments, you need to log in
How to automate mass connection via ssh?
I'm tired of doing monkey work, and I would like to devote time to work on more interesting tasks. I want to automate everything and enjoy. I understand that knowledge of tools and all kinds of programming languages will help in everything, but I want to learn something that will really help you in doing your job. This question is not for finding a specific answer (which of course would also be cool and great), but for helping the way, how to do it and where to dig.
From time to time, you need to connect to ~300+ pieces of hardware via ssh and enter the same command for all, but there are nuances that are difficult to bypass by Google (especially if you don’t know the basic tools like ansible, etc.).
Answer the question
In order to leave comments, you need to log in
ansible is well suited for server configuration tasks where the task code is downloaded to the client and executed there.
for stupid tasks like logging in via ssh and executing a couple of commands, it’s not good
for this, it’s overcomplicated, cumbersome and clumsy,
and it’s also famous for its backward incompatibility,
every major release will have to rewrite scripts,
I would use scrapli + nornir for such a task,
only both of them don’t work with windows
what is the problem with ansible? It seems that he was created exactly for this?
Expect is perfectly able to touch such stupid pieces of iron, which are written about in your paragraphs. 1-3. It is quite possible to confuse all this within the framework of some Ansible, etc.
You can use a script on the bash.
On Windows there is a chic MobaXterm program, in the free version it has restrictions on the number of sessions, the paid version bites the price, but perhaps it will help you with something.
Look at https://gist.github.com/mbbx6spp/c16b5438270be6096... if you are too lazy to learn Ansible
Since there is a Windows tag, then the script is in Powershell. He knows how to ssh out of the box and in foreach you can iterate through the list of machines.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question