This sounds like you want a define rather than a class.
http://docs.puppetlabs.com/guides/language_guide.html#defined-resource-types
I end up with something like this (gross, horrible, works, nfs client
installation not shown):
define mail::mount ($mountpoint, $source) {
include nfs::client
file { $mountpoint: ensure => directory, }
mount { $mountpoint:
ensure => mounted,
device => $source,
options =>
'tcp,rsize=32768,wsize=32768,hard,nointr,timeo=600,retrans=2,mountvers=3,nfsvers=3',
fstype => 'nfs',
atboot => true,
require => [File[$mountpoint], Class['nfs::client']],
}
}
mail::mount { 'mail0': mountpoint => '/mail/mail0', source => 'filer:/mail0' }
mail::mount { 'mail1': mountpoint => '/mail/mail1', source => 'filer:/mail1' }
On Tue, Jan 31, 2012 at 07:39:28AM -0800, Olivier wrote:
> Hello
>
> I get the following error:
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Duplicate definition: Class[paramclassexample] is already
> defined in file /etc/puppetlabs/puppet/manifests/site.pp at line 152;
> cannot redefine at /etc/puppetlabs/puppet/manifests/site.pp:155 on
> node cmnapwbe040
>
> Let's look at the Puppet Documentation code on parameterized classes:
>
> # /etc/puppetlabs/puppet/modules/paramclassexample/manifests/
> init.pp
> class paramclassexample ($value1, $value2 = "Default value") {
> notify {"Value 1 is ${value1}.":}
> notify {"Value 2 is ${value2}.":}
> }
>
>
> /etc/puppetlabs/puppet/manifests/site.pp
> class {'paramclassexample':
> value1 => 'Something',
> value2 => 'Something else',
> }
> class {'paramclassexample':
> value1 => 'Other',
> }
>
> My problem is that I need to call the class multiple times in the
> site.pp file but with different parameters. How can I do that?
>
> Thank you
>
> Olivier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.