Remote job execution through ssh failed from foreman GUI

/var/log/secure log from client:

Jan  9 14:40:26 foreman-server sshd[456874]: Connection from 10.1.235.60 port 60868 on 10.1.235.54 port 22
Jan  9 14:40:26 foreman-server sshd[456874]: Accepted key RSA SHA256:mqVHwwV0mMk/lWJPeV/2po1kUUQAkxYWYhBii6ulr+0 found at /root/.ssh/authorized_keys:1
Jan  9 14:40:26 foreman-server sshd[456874]: Postponed publickey for root from 10.1.235.60 port 60868 ssh2 [preauth]
Jan  9 14:40:26 foreman-server sshd[456874]: Accepted key RSA SHA256:mqVHwwV0mMk/lWJPeV/2po1kUUQAkxYWYhBii6ulr+0 found at /root/.ssh/authorized_keys:1
Jan  9 14:40:26 foreman-server sshd[456874]: Accepted publickey for root from 10.1.235.60 port 60868 ssh2: RSA SHA256:mqVHwwV0mMk/lWJPeV/2po1kUUQAkxYWYhBii6ulr+0
Jan  9 14:40:26 foreman-server sshd[456874]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan  9 14:40:26 foreman-server sshd[456874]: User child is on pid 456878
Jan  9 14:40:26 foreman-server sshd[456878]: Starting session: command for root from 10.1.235.60 port 60868 id 0
Jan  9 14:40:26 foreman-server sshd[456878]: Close session: user root from 10.1.235.60 port 60868 id 0
Jan  9 14:40:26 foreman-server sshd[456878]: Received disconnect from 10.1.235.60 port 60868:11: disconnected by user
Jan  9 14:40:26 foreman-server sshd[456878]: Disconnected from user root 10.1.235.60 port 60868
Jan  9 14:40:26 foreman-server sshd[456874]: pam_unix(sshd:session): session closed for user root

Is there anything logged in /var/log/secure for the remote execution?

Why is the server name in foreman foreman-server.local? You have used foreman-server.com before. Looks like a incomplete hostname or some incorrect set hostname.

/var/log/secure for remote execution job:

Jan  9 14:44:03 foreman-server sshd[456933]: Connection from 10.1.235.60 port 60882 on 10.1.235.54 port 22
Jan  9 14:44:03 foreman-server sshd[456933]: Accepted key RSA SHA256:mqVHwwV0mMk/lWJPeV/2po1kUUQAkxYWYhBii6ulr+0 found at /root/.ssh/authorized_keys:1
Jan  9 14:44:03 foreman-server sshd[456933]: Postponed publickey for root from 10.1.235.60 port 60882 ssh2 [preauth]
Jan  9 14:44:03 foreman-server sshd[456933]: Accepted key RSA SHA256:mqVHwwV0mMk/lWJPeV/2po1kUUQAkxYWYhBii6ulr+0 found at /root/.ssh/authorized_keys:1
Jan  9 14:44:03 foreman-server sshd[456933]: Accepted publickey for root from 10.1.235.60 port 60882 ssh2: RSA SHA256:mqVHwwV0mMk/lWJPeV/2po1kUUQAkxYWYh
Bii6ulr+0
Jan  9 14:44:03 foreman-server sshd[456933]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan  9 14:44:03 foreman-server sshd[456933]: User child is on pid 456937
Jan  9 14:44:03 foreman-server sshd[456937]: Starting session: command for root from 10.1.235.60 port 60882 id 0
Jan  9 14:44:03 foreman-server sshd[456937]: Close session: user root from 10.1.235.60 port 60882 id 0
Jan  9 14:44:03 foreman-server sshd[456937]: Starting session: command for root from 10.1.235.60 port 60882 id 0
Jan  9 14:44:03 foreman-server sshd[456937]: Close session: user root from 10.1.235.60 port 60882 id 0
Jan  9 14:44:03 foreman-server sshd[456937]: Starting session: command for root from 10.1.235.60 port 60882 id 0
Jan  9 14:44:03 foreman-server sshd[456937]: Close session: user root from 10.1.235.60 port 60882 id 0
Jan  9 14:44:03 foreman-server sshd[456937]: Starting session: command for root from 10.1.235.60 port 60882 id 0
Jan  9 14:44:03 foreman-server sshd[456937]: Close session: user root from 10.1.235.60 port 60882 id 0

Sorry I am not using DNS and there was a wrong entry in /etc/hosts file. I have corrected that but error is same.

[root@foreman-master ~]# sudo -u foreman-proxy ssh -i /var/lib/foreman-proxy/ssh/id_rsa_foreman_proxy root@foreman-server.local date
Mon Jan  9 15:09:16 CET 2023
[root@foreman-master ~]#

I got the issue resolved. /var/tmp was mounted with noexec option for target. I knew on foreman server we have to use exec but was not sure if it has to be for the targets as well. aruzicka mentioned it earlier but I only checked on foreman server. Remote job execution through ssh failed from foreman GUI - #12 by aruzicka
Thank you guys for all your quick responses but it was a miss from my end and a new learning as I am just getting started with this. I think I will se you guys around more often.
Solution:

1. My first error was ` **Could not establish connection to remote host**`. I came to know that since I was not using DNS service the client fqdn was not getting resolved so job was failing. So either entry in /etc/hosts or enabling the `connect by IP` option in `Administer -> Settings -> Remote Execution` tab worked.
2. The second error `Failed to execute script on remote machine` got resolved by changing the mount option `noexec` to `exec` for `/var/tmp` and ` /tmp` on client.