Hi,
I tagged this onto the end of another question and didn’t get any answers… so am trying to figure it out myself, but the more I look at it the more I don’t understand.
AWS Linux instances do not allow connecting via SSH as root by default… if you ssh as root, it tells you to connect as ec2-user and then just disconnects after a few seconds.
So I am trying to create a playbook to connect to all AWS Linux instances, AWS, RHEL, Centos, Ubuntu. They have different users, so I am trying different users until it works and the run the rest of the playbook. (you can also have your own AMIs and instance that may only have root enabled)
The problem is when I try to connect to this AWS Linux instance as root, it doesn’t fail. I get
TASK [try users] ******************************************************************************************************************************
[WARNING]: Unhandled error in Python interpreter discovery for host 10.5.162.167: unexpected output from Python interpreter discovery
[WARNING]: sftp transfer mechanism failed on [10.5.162.167]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: scp transfer mechanism failed on [10.5.162.167]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: Platform unknown on host 10.5.162.167 is using the discovered Python interpreter at /usr/bin/python, but future installation of
another Python interpreter could change this. See https://docs.ansible.com/ansible/2.8/reference_appendices/interpreter_discovery.html for
more information.
ok: [10.5.162.167]
So I am unable to fathom why it seems to be connected and finding a python interpreter at /usr/bin/python … how does it get that far and why doesn’t it just fail?
It produces warnings, but ultimately an OK which means it will then try and run the rest of the playbook – I guess that would fail eventually, but that seems sloppy. If I connect as another user that doesn’t exist it fails with permission denied.
Any advice would be greatly appreciated as I am about out of ideas right now.
Thanks
Bill