Sharing my testcase below demonstrating the problem that one can replicate:
I have ssh connectivity from ansible host to JUMP Servers with root user as below:
anuser1@ANSIBLE_HOST# ssh root@10.0.0.1 ----------> success anuser1@ANSIBLE_HOST# ssh root@10.0.0.2 ----------> success
Below is the command i use to execute my playbook:
ansible-playbook /app/playbook/injectkey/injectkey.yml -e JUMP_SERVER=‘10.0.0.1\n10.0.0.2’ -e TARGET_SERVER=‘192.0.0.99’ -e TARGET_USER=‘root’ -vvv
Below is my playbook injectkey.yml: