It has been solved. I found out we were using old foreman_callback.py
file https://github.com/theforeman/foreman_ansible/commit/321bd8453ab0ffab6818ea487cf21fba5f3e0be5
instead of a new one from foreman-ansible-modules
repository https://github.com/theforeman/foreman-ansible-modules/blob/develop/plugins/callback/foreman.py
Also, 500 Server Error: Internal Server Error
was caused by using hostname instead of fqdn.