On Fri, Feb 25, 2011 at 3:25 PM, Mohamed Lrhazi <lrh...@gmail.com> wrote:
> Thanks a lot Nick for the detailed response. Not sure I fully
> understand yet. I dont think I can use option one because the external
> classifier would does not have access to the clients facts. I will
> read about parametrized classes and learn to use them, though I dont
> yet see how they can solve my immediate need... I am also not sure yet
> I understand option three :) Let me describe my immediate need:
>
> I like to have a per-host module, because I love modules, so I dont
> use a node definition per host, but just one default node def.
>
> In my site.pp I set all my "global variables', then include nodes.pp
> In nodes.pp, I have something like:
>
> node 'default' {
>
>    include "$perhost_module"
>
>    include gu_common
>    include gu_auth
> ...
> }
>
> $perhost_module is generated by a function in site.pp, from the $host
> fact, to replace dashes with underscores.
>
> In module gu_auth, I have templates that use a variable $auth_aaa,
> which I might also need to use similarly elsewhere.
>
> Question:
> How do I set my var to a default value for all nodes, but then
> customize it in the perhost module.
> I can always set it to the default value in each and every perhost
> module, but is there another way?

I'm thinking you are looking to do something like

class perhost_module {
  $auth_aaa = $custom_fact ? {
    "someval" => "override",
    default  => $::auth_aaa
  }
}

class gu_common {
  notice ($perhost_module::auth_aaa)
}

node 'default' {
   include perhost_module
   include gu_common
}

Thanks,

Nan

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to