Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Alex, This is a nice one, however i have to keep the password into the code, is there a way if we can use a kind of Ansible vault, i'm not pretty familiar with using class but will get into it.
Many thanks indeed for the detailed answer @Anonymous , However, i need the output results in a similar format which is in my original post, can you club your suggested code as one piece. +1 already.
Josay, that will not do the job because if i will use dataBlock = line instead of dataBlock = dataBlock + line then it will not print host names. +1 for the throwing an idea