Nested hosgroup and hiera

Problem:

I would like to use the foreman hostgroups within hiera as I would like to have the data on Git. More specifically I would like to use nested hostgroup. But it seems that to manage the inheritence between parent and children hostgroup is complicated. I found this post from 2020 but I seems a bit hackish. I also didn’t find anything in either the puppet or foreman documentation for this problem

Expected outcome:
I would expect there is a simpler way to do it than in the link above.

Foreman and Proxy versions:
Foreman: 3.14.0
Puppet server: 8.7

Distribution and version:
Ubuntu 22.04

I’m the author of the linked post, and figured I’d chime in. I have no idea what the state of the art has been since then, but the solution that I described worked excellently for what we needed it for, at the time.

We did not have that many host groups and we were “only” working with a number of servers on the order of hundreds at the time, but didn’t find anything that we felt were blockers or fundamental issues with that solution.

Good luck, if you find something else, I know I’m curious to hear about it.