Finally, I do recommend looking into the Foreman Ansible collections for automating your Foreman configuration.
See this thread for some discussion on this.
I also recommend @evgeni’s Fosdem talk on this topic.
(You want the “yourmanagementlayershouldbecattletoo.mp4”)