On Mar 20, 11:49 am, Felice Pizzurro <felice.pizzu...@softecspa.it>
wrote:> Hi all,
>
> In my datacenter I''ve a configuration like this:
>
> class apache2 ($max_fork=100, $monitor=true) {
> # some implementation that utilize $max_fork and $monitor
> variables
>
> }
>
> class mysql ($max_conn=200, $monitor=true) {
> # some implementation that utilize $max_conn and $monitor
> variables
>
> }
>
> class php ($max_execution_time=10){
> # some implementation that utilize $max_execution_time variable
>
> }
>
> class webserver ($max_fork=100,$max_execution_time=10, $monitor=true)
> {
> class { ''apache2'' :
> max_fork => $max_fork,
> monitor => $monitor
> }
>
> class { ''php'' :
> max_execution_time => $max_execution_time
> }
>
> }
>
> class db ($max_conn=200, $monitor=true) {
> class { ''mysql'' :
> max_conn => $max_conn,
> monitor => $monitor
> }
>
> }
>
> class completeserver ($max_fork, $max_execution_time, $max_conn,
> $monitor) {
> class { ''webserver'' :
> max_fork => $max_fork,
> max_execution_time => $max_execution_time,
> monitor => $monitor
> }
> class { ''db'' :
> max_conn => $max_conn,
> monitor => $monitor
> }
>
> }
>
> node example {
> $max_fork=200
> $max_execution_time=30
> $max_conn=500
> $monitor=false
>
> class { ''completeserver'':
> max_fork => $max_fork,
> max_conn => $max_conn,
> max_execution_time => $max_execution_time,
> monitor => $monitor
> }
>
> }
>
> This configuration works fine and allows me to override all parameters
> in classes apache2, mysql, php directly on the node definition.
> The problem is that I have to report any parameter present in every
> base class through every classes that includes it. The result is that
> completeserver class has all defined parameters and if I need to add
> another parameter, for example, in apache2 class, I have to add this
> parameter also in webserver class and completeserver class and this is
> not so useful.
Indeed.
> Has someone solved the same problem in a more elegant way?
Yes: use external data (hiera / extlookup) instead of class
parameters.
Alternatively, avoid declaring parameterized classes within other
parameterized classes, at least where it would require multiplying
class parameters. This will likely result in more classes being
declared at the node level, but there''s nothing inherently wrong with
that.
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.