I am not sure what is going on and hence I enquiring here as well in hopes that some of you might.
I am trying to figure out why the same one-liner will successfully connect on my remote server
ansible-playbook initial.yml -u root -e 'host_key_checking=False'
but if I run this same one-liner from inside a shell script, then I will get:
fatal: [*********]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: root@*************: Permission denied (publickey).\r\n", "unreachable": true}
I have tried with sudo and without. The shell script is inside the same directory.
Any thoughts?