I'm joining this project now. I made inquiries a few months ago, and
finally our internal puppet management team green-lighted me for the
enhancements that needed to be made.
The main focus point and primary obstacle to my enhancements is
external_node_v2.rb (puppet-foreman subproject). I thank +domcleal for
pointing me in direction of this file. It looks like it was originally
authored by +ohadlevy and most recently by +mmoll. What I need to do is as
follows: We use The Foreman purely as an ENC to puppet – pretty much
nothing else. We assign classes to hosts, and tag hosts as belonging to
hostgroups and organizations.
TheForeman's hostgroups feature does not integrate well with puppet. This
would seem to be an obvious use-case, but for whatever reason, we're (UIBK)
somewhat alone here. A hostgroup in TheForeman consists of an entire
hierarchy of hostgroups. When TheForeman is queries as an ENC for a
particular node, we get something like:
What we want is that each hostgroup triggers a different Hiera file to be
read. Our hiera.yaml file contains directives like this:
The result is that the hiera files will be processed in the following order:
But there is no easy/clean way to get the hiera backend to process the
hostgroup fact in such a way.
We can use the foreman to load a fact file on the client which will then
report its facts. However, on the first run, the fact file will be empty
and incomplete. This creates probelms for deployment.
After discussions with domcleal, the simplest solution seems to be to
modify the external_node_v2.rb file, which is replaced as node.rb on the
I have created such a patch … BUT I feel the strong need to refactor the
code. A lot of this code does things that are completely mysterious to me
(what's "push facts" for?), so I need to get a discussion going with all
the maintainers of this file.