Can't execute ansible remote executions

When trying to run any ansible tasks (command, playbook, roles etc) I get the following:

TASK [Gathering Facts] *********************************************************
        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

1 Like

Solved it. Needed to add remote execution ssh to my ansible smart proxy

1 Like

Interesting, how did you get a smart proxy with ansible but without remote execution ssh?

Not exactly sure but I was using foreman-installer

What exact options did you pass to it?