I use hiera to assign classes to my nodes, such as webserver or dbserver . The webserver class includes only apache and sets up some configuration for it (for example, port). Obviously, I do not want to replicate this configuration for each node, so I put it in common.yaml. However, my common.yaml is getting big, so I want to split it. I would like to have one file containing the configuration for the webserver role, another for the dbserver role, etc. I imagine that my hiera.yaml looks something like this:
:hierarchy: - "fqdn/%{::fqdn}" - "role/%{ROLE}" - common
If the role folder contains files like webserver.yaml , appserver.yaml , dbserver.yaml . I saw various blog posts saying that the solution is to create a personalized βroleβ fact, but most of them achieve this by loading this fact from a file on the node agent (for example, from /etc/role ), which seems to me that he defeats the puppet point (I use the puppet specifically, so I do not need to go into each node and change the configuration every time I want her to have some new role).
To be clear, I do not want to edit the files in the agent to make this work, I want all this to be done using the configuration located on the main server.
I assume that I could have something like the following and exhaustively list each role as an element in the hierarchy, but this does not seem manageable.
:hierarchy: - "fqdn/%{::fqdn}" - "webserver" - "appserver" - "dbserver" - common
Is there any way to solve this?
source share