ssh difference between ansible ad-hoc and ansible-playbook for localhost

I noticed in troubleshooting SSH authentication that there is a difference between ansible ad-hoc and ansible-playbook in terms of SSH for localhost.

Specifically, I was able to get a playbook targeted at localhost to work but not ansible ad-hoc command targeted at localhost.

To be more specific, ad-hoc command checks in ~/.ssh/authorized key whereas playbook does not. I didn’t specific any user in the playbook whereas I try to run as root/ubuntu/none with ad-hoc (-u).

That sounds really - odd.

It sounds silly, but are you _sure_ ansible and ansible-playbook are
at the same version?

ansible --version
ansible-playbook --version

Maybe there's some symlink spaghetti going on or something??

If not, that sounds like a bug, I'd file an issue.

Apparently ansible-playbook is a symlink on this system; I had /usr/bin/ansible owned by the group ansible before but I changed it back to root for testing & got so result. What is more weird is that if ansible-playbook is just a symlink why is the behavior different?

`
root@ip-172-17-0-237:/etc/ansible# ansible --version
ansible 2.1.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides

root@ip-172-17-0-237:/etc/ansible# ansible-playbook --version
ansible-playbook 2.1.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides

root@ip-172-17-0-237:/etc/ansible# ll /usr/bin/ansible
-rwxr-xr-x 1 root ansible 4201 May 25 13:03 /usr/bin/ansible*

root@ip-172-17-0-237:/etc/ansible# ll /usr/bin/ansible-playbook
lrwxrwxrwx 1 root root 7 May 25 13:03 /usr/bin/ansible-playbook → ansible*

`

I checked on another older version and ansible-playbook is a script:

`

✘ antho@stratus  ~/.ssh  which ansible
/usr/bin/ansible
antho@stratus  ~/.ssh  which ansible-playbook
/usr/bin/ansible-playbook
antho@stratus  ~/.ssh  ll /usr/bin/ansible-playbook
-rwxr-xr-x+ 1 antho antho 3.9K May 22 23:18 /usr/bin/ansible-playbook
antho@stratus  ~/.ssh  ansible --version
ansible 2.0.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
antho@stratus  ~/.ssh  ansible-playbook --version
ansible-playbook 2.0.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
`

btw here’s the playbook i used for testing; nothing fancy:

`
ot@ip-172-17-0-237:/etc/ansible# cat testing/test_var.yml