3

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.

1 Answer 1

3

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

6
  • Thanks for your answer. Yes I used the webui. I undertand the smart Class but it's global parameter who I want to understand (and smart Variables).
    – Darkjeff
    Oct 22, 2014 at 15:39
  • @Darkjeff Yeah, I saw that on reread of the question. Sorry for the quick shooting. I dimmly remember playing around with that an then ending up with using the class parameters, which then are global for the installation (or at least the environment in which you set the parameter). I'm not really sure the Foreman global parameter are intended the way you try to use them, since foreman can do way more than be a puppet enc.
    – Christoph
    Oct 22, 2014 at 15:47
  • 1
    "ntp_servers" is a global parameter that you can set under Configure > Global parameters, but the other examples you gave are class parameters and Christoph's answer is right. Most modules will use class parameters, you'd have to explicitly change them to use $::ntp_servers then inside the manifest if you wanted to use globals for some reason. Oct 22, 2014 at 15:48
  • Ok that answers to my question. So I have to use class parameter. What do you use for big value like 30 user creation ? It's a big hash not really easy to maintain.
    – Darkjeff
    Oct 22, 2014 at 15:59
  • So, after a look in the foreman manual and the comment from m0dlx: I could for example use ´my_ntpservers´ as a global parameter if I intend to write my own wrapper class, which then uses this parameter?
    – Christoph
    Oct 22, 2014 at 15:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .