Ask Your Question

profile/role design with Hiera

asked 2013-12-27 14:06:57 -0500


I have setup my profile and role design, based upon many examples on the internet, but mostly based on the popular blog article of Craig Dunn.

I am now at a point, that I want different configurations for certain profiles. I believe the best I could use is Hiera. However, I am not certain yet how to implement. Let's say I want to set error_reporting in the php.ini template on a certain value, based if we are "dev" or "production". Let me show you my current setup:


class role::webserver::dev inherits role::webserver ...
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-12-27 16:56:50 -0500

Hello !

Yeah hiera does exactly that, but you will need to refactor your puppet code. Think of it this way :

  • puppet is your code
  • hiera is the configuration of the code (puppet)

One good indication that your code is written properly is that you should not have any switch / case in your code.

So how do we get there ? You need to have your puppet client to pass some information to the puppet master, there are multiple ways, I like the facter approach : you write a custom fact based on the fqdn , ex : ( stg-memcache123 ... (more)

edit flag offensive delete link more


Thanks for your answer. Would you suggest that I would go for one profile::php instead of a split between dev/live? So configuration is based on role::webserver::dev ...(more)

P.T. gravatar imageP.T. ( 2013-12-28 06:18:54 -0500 )edit

That's right, basically puppet tells you what file, package goes where, puppet code is not aware of where the code will be run ; Hiera is.

Julien R. gravatar imageJulien R. ( 2013-12-30 20:31:43 -0500 )edit

answered 2014-04-24 12:30:48 -0500

brutus777 gravatar image

Hi, I developed a custom hiera backend that dynamically generate the hierarchy based on profile classes assigned to the node. This way, you may have different yaml files for each profile. You can find the code at Please tell me if you find my approach useful.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2013-12-27 14:06:57 -0500

Seen: 1,283 times

Last updated: Apr 24 '14