Foreman vs. hiera

As an example: in foreman I include the locales class. But I don’t set any smart class parameters, ie. I want to define the list of locales in hiera.
In the YAML in foreman I have:

classes:
locales:

In Hiera I have:
locales:
locales:
- C.UTF-8
- nb_NO-UTF8

I expected the list of locales to be read from hiera. What I can do is specify the list of locales, as
locales::locales:

  • C.UTF-8
  • nb_NO-UTF8

I am using the latest foreman 2.4.0

Now I notice that classes are in fact configured under classes. Ie:

classes:
ahsay::cbs:
version: 8.5.0.127-850159-1
autofs:
chrony:
servers:
- 0.ie.pool.ntp.org
- 1.ie.pool.ntp.org
- 2.ie.pool.ntp.org
- 3.ie.pool.ntp.org
cron:
epel:
locales:
fail2ban:

Shouldn’t classes, just be an array of classes? Not a complete hash of configuration.

Seems to be that there is an erroneus merge of the classname/top level variable name.

::locales is a namespace, not the actual class. Or rather

::classes:

  • locales
  • fail2ban

can should be configured using:

::fail2ban
::locales

Not:

::classes:
fail2ban:
locales:
locales:

Other relevant data:

Hi there,
Just to understand you, when you say Hiera, which Hiera file did you configure? How is it configured? It changes a lot as you could have per class hiera, per environment hiera, etc. and you can define several things there on how to create a hierarchy based on what you define.
You saying to have

Blockquote
In Hiera I have:
locales:
locales:

  • C.UTF-8
  • nb_NO-UTF8

while in hiera file I have for example:

path: “location/%{facts.whereami}/%{facts.group}.yaml”
path: “groups/%{facts.group}.yaml”
path: “os/%{facts.os.family}.yaml”

As a guess on what im seeing (maybe wrong, but a guess) you do not need to define classes, just put the module/class there. Foreman does work as an External Node Classifier (ENC) with information/facts that will be parsed by puppet or any other software and depending on the info it gets, what’s going to do.

Another thing you need to consider is what does the node see, do something like : puppet lookup kmod --explain to see how your values and ‘final’ node definition is compiled for the client. which is different from what you see at YAML for the node from foreman itself. (I personally had a headache until I understood correctly how it works)