Hi all,

I recently moved from puppet 3 to puppet 5 and hiera 1 to 3. I'm taking
this opportunity to change a little bit the hierarchy setup I've been using
for the last years.
In my previous conf I used to create a custom fact for each role so I could
do something like:

- "%{environment}/hieradb/role/%{::role}"

and in each role file I specified the classes and any other role bases
customizations for the role. So far so good. This approach is something
that I'll continue using.


But now I'd like to do something similar with profiles: add a custom fact
for each profile so I can later use something like:

- "%{environment}/hieradb/profile/%{::profile}"

Obviously this approach does not work when you have more than one profile:

First, I'd need to create the profile custom_fact as an array of several
profiles and, then, I'd have to tell hiera to look in every profile from
the same hierarchy level. In a node with profiles A/B/C hiera should have
to look in the files:

"%{environment}/hieradb/profile/profileA.yaml"
"%{environment}/hieradb/profile/profileB.yaml"
"%{environment}/hieradb/profile/profileC.yaml"

Based on my tests (yup, I tried this) if hiera finds the value in, let's
say, profileB.yaml it stops scanning this level and profileC.yaml is not
evaluated.
In any case, even if hiera continues scanning all files in the same lelve,
this approach will create a conflic in hiera itself whenever it finds the
same variable defined in 2 profiles. ¿Which one should I choose?

So, the (obvious) solution is to move any profile customization to the role
level, the same I've been doing till now.
But I was wondering if some part of my approach could be possible (without
having to decalre all the possible profiles in my hiera  tree) or if
someone was somehow using the "profile" in the hiera tree (and how)?.


TIA,
Arnau

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAM69jx9szrMR3gqN_q2YLUYZq6qsROkRfoRea%3D-KvhGQ3%2BqH2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to