On 05/02/2014 09:32 PM, Vincent Miszczak wrote:
> If I use a single role for a node(can be achieved by hiera("role") and
> %{role}), I have to write 3 roles : app,database,appanddatabase and put
> classes in them. Then, when I change the settings for database, I have
> to write the changes in every role somethinganddatabase => error prone.
> If I use a wrapper class for each role that encapsulate the settings,
> when I change settings, I'm writting Puppet code while I want to do this
> with hiera (not the same guys behind).
Hmm, I don't have first hand experience with the pattern, but I believe
you fail to include profiles in your model.
The intent is to have a profile for whatever a node might need to do, in
your example, there might be an appserver profile and a database
profile. (In reality, those are probably devided into an apache profile,
php profile, java profile, mysql profile, oracle profile etc.)
Now the three roles you sketched will include profiles like
app: appserver
database: database
appanddatabase: appserver, database
Since it's the profiles that do all the work, there is no code
duplication to worry about.
Hope that makes sense,
Felix