This will work, but I'd use a selector.   Search for "selector" in
this document:  http://docs.puppetlabs.com/guides/more_language.html

The reason being, is you could supply a default if no match was found,
rather than it just generating an error.

I would use one to assign a variable to the template name, and just do
template($template_name) as normal, that way you don't evaluate
template() more than once.

A node can belong to more than one class, so I wouldn't rely on the
idea of using $CLASSNAME.    (For instance, the external nodes system
could say "I'm a webserver", and "I'm also an appserver" later.

Since you're using cobbler, you any --ksmeta variables you set are
available as variables in Puppet.

(Others can see docs on this here:
https://fedorahosted.org/cobbler/wiki/UsingCobblerWithConfigManagementSystem
)

Parameterized classes, coming in the next release, will make this a
lot easier -- though it's something Cobbler's going to have to adapt
to.

--Michael

On Fri, Apr 30, 2010 at 6:10 AM, Peter Meier <peter.me...@immerda.ch> wrote:
>> but I'm not too sure how to set the value of $CLASSNAME.
>
> we do something similar:
>
> file{'/etc/exim/exim.conf':
>  source => [ "puppet://$server/modules/site-exim/${fqdn}/exim.conf",
>              "puppet://$server/modules/site-exim/${exim_type}/exim.conf",
>              "puppet://$server/modules/site-exim/exim.conf",
>              "puppet://$server/modules/exim/exim.conf" ],
>  require => Package['exim'],
>  notify => Service['exim'],
>  owner => root, group => mail, mode => 0640;
> }
>
> http://git.puppet.immerda.ch/?p=module-exim.git;a=blob;f=manifests/base.pp;h=a0b2d02ca3e1a95b0ddc0b48fa54efb5d2981774;hb=76f594abd5dabffe86bdaeecb99b15bda4b968fc#l13
>
> what we do then is to set per node the variable (or in an external node tool
> called parameter) $exim_type to set it to something like 'antivirus',
> 'webhosting' or whatever. and then have in site-exim/files/antivirus/ the
> appropriate config file.
>
> btw: we nearly got rid off that, as we started to split the exim
> configuration into different subfiles and including them. We then deploy
> only these include files based on exim_type. This has the advantage, that we
> have only one identical main-exim config and do all the tweaks in little
> files we just include.
>
> cheers pete
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-us...@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-us...@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