Hello Florian,

Am 15.03.2012 20:47, schrieb Florian Koch:
> i have some trouble with hiera and  %{calling_module}.

i have had a similiar problem. You need to submit the values to the define.

> i have:
> 
> class tomcat::instance{
>         $instances = hiera('tomcat_instances')
>         tomcat::installer{$instances:}
> }
> 
> define tomcat::installer {
>         require 'tomcat'
>
>         $instance_opts = hiera($name)
>         $tomcat_user = $instance_opts[user]
>         $tomcat_group = $instance_opts[group]
>         $basedir = $instance_opts[basedir]
>         $logdir = $instance_opts[logdir]
>         $tomcat_name = $instance_opts[name]
> 
>         $tomcat_version='6'
> ...
> }

You should try something like this:

class tomcat::instance {
   $instances = hiera('tomcat_instances')

   tomcat::installer { $instances[name]:
      basedir => $instances[basedir],
      logdir  => $instances[logdir],
      user    => $instances[user],
      group   => $instances[group],
   }
}

define tomcat::installer ($basedir, $logdir, $user, $group) {
   ...
}

I am using this method for my Icinga module
(http://github.com/dhoppe/puppet-icinga). You should take a look at the
following files:

   - examples/icinga.yaml
   - manifests/contact.pp
   - manifests/contact/contacts.pp

Regards, Dennis


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to