Hi Group,
Ansible looks really fine, and I am just starting out with using it to facilitate running processes in parallel on multiple hosts of my client.
In short: Is there any way to run one ansible command over multiple hosts, where the login name used among the hosts need not be the same for all hosts?
Below is a brief explanation of the setup of my client (I have no control over the logins that I am allowed to use on each host) and failed results of my efforts.
However, I do not have root access on any host, but rather I have N multiple groups of hosts, and I want to run the same ansible command on all the remote hosts with one ansible call from my local host.
For simplicity, say N is only 2, so I have group A and group B of remote hosts.
However, on group A of hosts my only authorized login id is userA and on group B of hosts my login is userB.
My id_rsa.pub file contents are pasted to the proper hostX:~userX/.ssh/authorized_keys files under the proper logins on all the remote hosts.
Now on my localhost ( this is also my main ansible-launcher host) I do have my .ssh/config set up with a stanza for each of these remote Group A and Group B hosts that include for each host a proper User setting and an IdentifyFile setting pointing to my ‘paired’ id_rsa file.
This allows me to do ‘passwordless’ and ‘unspecified user’ ssh connections from my localhost to any remote GroupA or GroupB host such as $ssh hostA01 or $ssh hostB12.
I get the message of the day on each one and a shell prompt without an intervening password challenge. So that’s a good start.
I have tried to use:
$ ansible all -a “/bin/echo hello” --connect=ssh
to get the echo to emit for a remote host named in ansible_hosts, but it seems even though I specify --connect=ssh that the ssh config file’s stanza’s ‘User’ may not be being used?
I get output for the message of the day, but rather than a shell prompt, I get: