How use global parameters in Forman

foremanpuppet

I'm new in Foreman, and I want to use a parameter for all my hosts managed by puppet and I think to use the global parameters it's a good way. But I can't understand how use it.

For exmple if I take the ntp module and if I want to have the same ntp server on all the host how I have to declare the global parameter and the documentation are very poor…

I tired :

ntp_servers = time.nrc.ca

$::ntp::servers = time.nrc.ca

::ntp::servers = time.nrc.ca

ntp::servers = time.nrc.ca

No ones match.

Best Answer

I assume you use the foreman WebGui:

If you are in the Smart Class Parameter tab of the ntp class, select servers, check the Override Box an then select array for Parameter type. Then input the list of your desired timeserver in the following form:

["timehost1.domain.tld","timehost2", ...]

It took me a while myself to figure that out. In general, you need to know or find out which type is expected from the puppet module. I find myself looking into the code of the modules if it is not clear in the first place. Also, if you want to make a parameter over writable somewhere down the road of host groups or whatever you use for node of different types, I found that you have to set the default yourself. The builtin default only works while Override is unchecked. At least for modules like ntp which have a params subclass. Otherwise you end up with errors stating the parameter was not found/could not be set or similar.

I'm fairly new to puppet myself, so if anyone has a better explanation I'd be glad.

Cheers, Christoph

Screenshot enter image description here

Related Topic