Ask Your Question

Additional Classification Needed for Nodes in Hiera

asked 2015-03-13 17:18:36 -0600

jsemerica gravatar image

Hi All,

I've looked for a solution to this problem but it may be unique. Our Puppet 3.7 environment is about 800 RHEL nodes and our hostnames contain the following information.

datacenter OS environment project role of server (web, app, db...) server number

Our Hiera hierarchy currently looks like...


  • "%{::dcenv}/projects/%{::project}/node/%{::hostname}"
  • "%{::dcenv}/projects/%{::project}/role/%{::role}"
  • "%{::dcenv}/projects/%{::project}/%{::project}"
  • "%{::dcenv}/role/%{::role}"
  • "%{::dcenv}/%{::dcenv}"

So as it turns out the server role, for example app, isn't descriptive enough to determine which application and which type of configuration to get. Furthermore, servers may have the same application but different role, such as master/standby. The solutions I've been able to come up with so far...

Custom Facts in Facter - As I understand it, this may end up being a pretty large sized bash script if in one fact, otherwise would be a fact or each possible application and role.

Custom File on Servers - Would be a text file with more descriptive info. This would probably have to be manually created and another file to maintain.

A TXT Record in DNS with additional info - Probably a bad idea

So I'd like to try to find some middle ground between our current environment where nodes are classified with the high-level information above and doing each node individually.

Thanks for any and all help!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-03-14 03:06:55 -0600

In our environment we like to classify by applciation too, but our hostnames are not related to applications or application roles at all. The solution we use for this problem are some custom facts placed in a file in facts.d:

  • application_name : main name of the aplication
  • application_role : for the role within the application
  • application_instance : for different group of systems unrelated to other group of systems for same application, eg dev1, dev2, etc
  • application_<*>: for anything else you want to distinguish on, eg version
edit flag offensive delete link more


Good answer: for increasing hiera granularity, custom facts are the best way to go.

Joseph Carlos gravatar imageJoseph Carlos ( 2015-03-15 13:09:38 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-13 17:10:53 -0600

Seen: 199 times

Last updated: Mar 14 '15