This might shed some more light for you:

http://docs.puppetlabs.com/guides/troubleshooting.html#node-inheritance-and-variable-scope

Maybe you can create another class that handles 'server default'. Or create a 
custom fact that distinguishes these hosts from others.

I personally don't use my nodes to declare anything, I use a combination of 
classes, custom facts and extlookup of yaml files to describe my sites.

Cheers,
Den

On 05/08/2011, at 18:25, Thomas Rasmussen <rasmussen.tho...@gmail.com> wrote:

> Hi
> 
> Thanks for the reply, that works, but I'd like to keep my include of
> the sudoers::config in my default node section, but if I do that, then
> I don't have the $sudoenv variable available at that time.
> 
> Is there any way of overriding a previously include of a class? I
> tried to 'sudoers::config': sudoenv=> $sudoenv, stage => install;  in
> my server-defaults node definition, but puppet gave me a duplicate
> error on include.
> 
> I'm running 2.6.4 on both server and client side.
> 
> Regards
> Thomas
> 
> On Aug 5, 10:09 am, Denmat <tu2bg...@gmail.com> wrote:
>> Hi,
>> 
>> You setting sudoenv to default in the default node. That is not overridden 
>> by subsequent node declarations.
>> 
>> If you are using 2.6 and above I would pass a parameter to the sudoers class.
>> 
>>> class sudoers::config (env = 'default') {
>>>  file { "/etc/sudoers":
>>>    ensure => file,
>>>    owner => "root",
>>>    group => "root",
>>>    mode => 440,
>>>    source => "puppet:///modules/sudoers/sudoers_
>>> ${env}",
>>>  }
>> 
>> then maybe call like this.
>> 
>>> node 'server-defaults' inherits default {
>>>  class {"sudoers::config": env => 'custom_server' }
>>> }
>> 
>> then
>> 
>>> node default {
>>>  class {"sudoers::config": }
>>> }
>> 
>> That might help you.
>> 
>> Cheers,
>> Den
>> On 05/08/2011, at 17:02, Thomas Rasmussen <rasmussen.tho...@gmail.com> wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi
>> 
>>> I'm having some trouble with the following setup:
>> 
>>> node 'serverA' inherits server-defaults {
>>>  include myApp::install
>>> }
>> 
>>> node 'server-defaults' inherits default {
>>>  $sudoenv = 'custom_server'
>>> }
>> 
>>> node default {
>>>  $sudoenv = 'default'
>>>  include sudoers::config
>>> }
>> 
>>> class sudoers::config {
>>>  file { "/etc/sudoers":
>>>    ensure => file,
>>>    owner => "root",
>>>    group => "root",
>>>    mode => 440,
>>>    source => "puppet:///modules/sudoers/sudoers_
>>> $sudoenv",
>>>  }
>>> }
>> 
>>> I have then created to files: sudoers_default and
>>> sudoers_custom_server
>> 
>>> I want to have a default sudoers file on most of my servers, but on a
>>> few others, I need a different one, but on serverA I only get the
>>> sudoers_default file. I have tried to create it as a template (still
>>> using the $sudoenv varialbe) but this does not have any effect. Only
>>> if I move the include sudoers::config to the 'server-defaults' node,
>>> then it works as I want.
>> 
>>> Being somewhat new to puppet, I really cant figure out how I can solve
>>> this task, but hopefully somebody can give some good hints?
>> 
>>> There isn't any of my default variables that I can use instead of
>>> $sudoenv.
>> 
>>> Hope somebody has hints
>> 
>>> Regards
>>> Thomas
>> 
>>> --
>>> 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 
>>> athttp://groups.google.com/group/puppet-users?hl=en.
> 
> -- 
> 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.
> 

-- 
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