I read again task conditions. You must make passwordless ssh connection.
So, I think you must specify your id_rsa in inventory file: stapp01 ansible_user=tony ansible_ssh_private_key_file=~/.ssh/id_rsa
Try to ping with this inventory file.
Hi Bhard,
I have tried this task and succeeded but with one change in the inventory file. I used ansible_user=banner instead of ansible_host provided with the same password for the banner. However, I am confused with this as ping fails when giving ansible_hosts.
Please explain if possible.
Thanks.
Hi uwithnishad!
Im not quite clear understood your question. With stapp01 ansible_user=tony ansible_ssh_private_key_file=~/.ssh/id_rsa in inventory you say to ansible login tostapp01with usertonyfrom jump server. On jump server you login asthorand send your rsa key tostapp01server for usertonyon that server. On other hand you can specify in inventory usertonyand password for usertony` and this must work, but it definetly unsecure.
HI,
I meant when I gave ansible_user=banner in my task with the password for banner. it worked out. Then I removed ansible_user rather I gave ansible_hosts it did not. So the point here is why it did not worked out with ansible host when details are already present on inventory file and also we passed the ssh-key to respective servers as per the tasks.
I meant when I gave ansible_user=banner in my task with the password for banner.
Your inventory was something like this: stapp03 ansible_user=banner ansible_password=pass ?
And this is correct and should work.
Next you try inventory like this: stapp03 ansible_host=stapp03 and have errors?
Well, this also correct.
stapp03 just name for host in inventroy. First ansible read ansible_host variable if it exists, nest try to login to host by name in inventory.
And if you omit username in inventory line, ansible try to login with current user from jumpserver, but user thor does not exist on stapp03 server.