Parameter for foreman server name?

Problem:

I want to know if there’s a param that will return the foreman server’s FQDN. Since were going to have several foreman servers at different sites it would be convenient and automated to be able to do that.

Expected outcome:

Execute first puppet run at end of provisioning template. Something like:

puppet agent -t <%= @puppet_server %>

Foreman and Proxy versions:

3.4

Foreman and Proxy plugin versions:

Distribution and version:
Redhat 8.l7

Other relevant data:

Is there some universal param that will always return the FQDN of the foreman server? Or do I have to set it manually in params myself on each foreman server? No big deal if I have to do that, but I prefer set and forget, so that each newly provisioned foreman server will automatically pass its own hostname when a provisioned host does its first puppet agent run.

Thanks!

I saw one promising post, but it looks like the OP never followed up and the answer doesn’t seem to work?

https://community.theforeman.org/t/is-there-a-template-variable-for-content-source/21736

If I try to use <%= @mediaserver %> it doesn’t return any value. I suppose another option would be to split @mediapath and just extract the server FQDN. Although I’m not great at ruby (I’m learning).

Well, you have to be more precise in which foreman server you want. Clients access various services through the foreman smart proxies. So it really depends on what you want. The smart proxy can do content, puppet master, ansible, logs, reports, … It may all run on the same server, but are different proxy features which could be on different servers. Thus, there is no single foreman server name…

alright. I’ll just create something and pass it down. Thanks.