On Mar 21, 1:40 pm, jcbollinger <john.bollin...@stjude.org> wrote:
> On Mar 21, 12:20 pm, hai wu <haiwu...@gmail.com> wrote:
>
> > I am going to use parameterized class together with extlookup, where
> > extlookup is used to provide different parameter value for different node
> > based on extlookup_precedence, the parameterized class needs to be declared
> > once in parent node, any issues you could forsee with this plan?
>
> I think the problems are few for which parameterized classes are the
> *best* solution.  Nevertheless the combination of parameterized
> classes with extlookup() may be the *most expedient* solution
> available at the moment.  It will very likely solve your problem.

Nevertheless, the way *I* would apply extlookup to the problem would
be more like this:

node default {
    class { sudoers: }
}

# No additional node definition needed for this purpose

class sudoers { # Not parameterized

    # This class should know how to choose
    # the default rule set for itself
    case $operatingsystem {
        "CentOS", "Debian", "Ubuntu", "Solaris":
            { $default_rules = $rules_unixgroup }
        default:
            { $default_rules = $rules_other }
    }

    # If you're using extlookup to get this, then
    # it's better to do it right here
    $additional_rules = extlookup("additional_sudo_rules")

    file { "/tmp/sudoers":
        owner   => root,
        group => root,
        mode => 440,
        content => template("sudoers/sudoers.erb"),
        notify  => Exec["check-sudoers"],
    }

    exec { "check-sudoers":
        command => "/usr/sbin/visudo -cf /tmp/sudoers && cp /tmp/
sudoers /etc/sudoers",
        refreshonly => true,
    }
}


Cheers,

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

Reply via email to