Ansible-playbook work in command line but not in foreman

Hello,

on my foreman, for some hosts, ansible command didn’t work with ssh access denied error.

no errors for others hosts

For theses hosts when i launch ansible-playbook in command line with foreman-proxy user, no connection problem, playbook execute well

Foreman-proxy pub key is in the root authorized_keys on theses hosts ( i can connect without password with foreman-proxy user)

An idea of what could be the problem ?

sorry for my english

i have found that foreman-proxy user has 2 keys :
id_rsa_foreman_proxy
id_rsa

for all the hosts, i use the id_rsa pub key
for the one that didn’t work, i have added the id_rsa_foreman_proxy and it work

the question is now why some hosts works with id_rsa and no others ?

I’d say the right question is why do you have two sets of keys in the first place. While not exactly wrong, it is still somewhat non-standard.

witch key is the standard one ?

id_rsa_foreman_proxy is the one generated by the installer and is canonically considered “the right one”.

ok thanks.
but why majority of hosts work with the “non standard” one ?

Hard to tell without knowing how you set up the keys both on the proxy side and their public key counterparts on the remote hosts