When trying to run any ansible tasks (command, playbook, roles etc) I get the following:
TASK [Gathering Facts] *********************************************************
5:
fatal: [ansible.<domain>]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Could not create directory '/usr/share/foreman-proxy/.ssh'.\r\nFailed to add the host to the list of known hosts (/usr/share/foreman-proxy/.ssh/known_hosts).\r\nno such identity: /usr/share/foreman-proxy/.ssh/id_rsa_foreman_proxy: No such file or directory\r\nroot@ansible.<Domain>: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).", "unreachable": true}
From my foreman machine if I:
sudo -u foreman-proxy ssh root@ansible.<Domain>
it asks for remote root password.
If I specify identity file -i /usr/share/foreman-proxy/.ssh/id_rsa_foreman_proxy I get a passwordless login
I can use remote execution to run e.g. “Run Puppet Once”, or “Run Command - SSH default”, it seems to be only ansible tasks that have the problem