Ansible roles dosn't work on delegated host



I noticed, in our Foreman environment, the ansible roles in the ansible smart proxy server when tasks are delegated to a different host rather than running on target host, task runs on control host which is the smart proxy server. This doesn’t not produce any error messages, also it shows that it switched from target host to delegated host, but the actual task runs on the control host.

HAs anyone any experience on this. I am testing using very simple ansible role which has two tasks, one runs on the target node and other run on delegated host. Both tasks only write a line in log file in temp directory. When task with delegate_to: is runs it show like this:

changed: [ ***<target host>*** -> ***<delegated host>*** ]

But the task actually happening in the control node (smart proxy node), not even in target node.
Un delegated task run correctly on target node.

Is this a bug, or some setup missing in ansible setup in Foreman smart proxy?

Please help me if anyone can.

Best Regards

I just wonder, if anyone has an idea about how to resolve this issue?

If anyone like to se further detail in this issue, thie will help to find the issue.
This is after run the job

The task delegating to different host has this:
xxxx is the FQDN of the different host.

The task should be running on the target node has this:
<999.999.999.999> ESTABLISH SSH CONNECTION FOR USER: foremanrec
999.999.999.999 is the IP address of the target host.