Hello Monks,

I have created a script that can run in parallel multiple ssh connections, I am using the Net::OpenSSH::Parallel module for my task. Well my problem now is that I do not know if there is a way to apply multiple ssh connections to different primary servers, and as a second step I need to apply ssh connections to secondary servers and execute a set of commands.

Update: Primary and secondary servers are first and second line of servers. Further analysis, I have a set of different servers that I need to ssh simultaneously, those are the primary servers. Once I login to the primary servers then as a second step I want to ssh to the secondary servers.

localhost --> Primary 1st --> Secondary 1st localhost --> Primary 2nd --> Secondary 2nd localhost --> Primary 3rd --> Secondary 3rd ... ... ... localhost --> Primary nth --> Secondary nth

So my question, is that possible to be done with Perl?

Update 2: I have found a possible solution, ssh tunnel via multiple hops but I was wondering if it can be done by a module or possibly to be combined with Net::OpenSSH::Parallel module.

It is mandatory and important to me to execute the commands simultaneously at all servers. this is the reason that I am using the Net::OpenSSH::Parallel module.

Once more thank you for your time and effort to assist me.

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to How to apply multiple parallel consecutive ssh sessions by thanos1983

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.